Added a save menu, fixed issues with loading from saves, updated to BDF
3, started working on a crafting system.
|
|
@ -41,6 +41,6 @@
|
|||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-stb-natives-macos.jar"/>
|
||||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-stb-natives-windows.jar"/>
|
||||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-stb-sources.jar"/>
|
||||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/binary-data-format-v2.4.jar"/>
|
||||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/binary-data-format-v3.0.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
/bin/
|
||||
hs_err_pid*
|
||||
settings.bdf
|
||||
layer.bdf
|
||||
*.bdf
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package projectzombie;
|
||||
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
|
||||
|
|
@ -9,14 +11,11 @@ import projectzombie.audio.AudioEngine;
|
|||
import projectzombie.audio.AudioSources;
|
||||
import projectzombie.display.DisplayStatsEventHandler;
|
||||
import projectzombie.display.DisplayWindow;
|
||||
import projectzombie.display.bossbar.BossBars;
|
||||
import projectzombie.entity.EntityEventHandler;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.init.Entities;
|
||||
import projectzombie.init.Items;
|
||||
import projectzombie.init.LayerGenerators;
|
||||
import projectzombie.init.Layers;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.init.Resources;
|
||||
import projectzombie.init.Sounds;
|
||||
import projectzombie.init.Tasks;
|
||||
|
|
@ -38,6 +37,7 @@ import projectzombie.world.chunk.ChunkEventHandler;
|
|||
|
||||
public class Main
|
||||
{
|
||||
public static Clipboard clipboard;
|
||||
public static MainloopManager mainloop;
|
||||
public static DisplayWindow window;
|
||||
public static EntityPlayer player;
|
||||
|
|
@ -51,14 +51,18 @@ public class Main
|
|||
|
||||
public static void main(String[] args) throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||
|
||||
worker = new Worker();
|
||||
worker.start();
|
||||
|
||||
MathHelpers.init();
|
||||
Settings.init();
|
||||
Environment.init(args);
|
||||
Cheats.init(args);
|
||||
|
||||
worker = new Worker();
|
||||
worker.start();
|
||||
|
||||
Items.init();
|
||||
Entities.init();
|
||||
Tasks.init();
|
||||
|
|
@ -99,8 +103,16 @@ public class Main
|
|||
// Start the mainloop
|
||||
menu = new MenuMain();
|
||||
mainloop.start();
|
||||
}
|
||||
|
||||
catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
finally
|
||||
{
|
||||
// Kill the worker thread
|
||||
worker.kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@ package projectzombie.display;
|
|||
import gl_engine.matrix.Matrix4;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.time.GameTimer;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class Camera
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public class DisplayLighting
|
|||
int x, y;
|
||||
|
||||
private int getID(int x, int y) {
|
||||
return (x + y * w) * 4 + 1;
|
||||
return (x + y * w) * 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ public class DisplayLighting
|
|||
|
||||
lighting_dirty = false;
|
||||
int size = (Chunk.RENDER_DISTANCE * 2 + 1) * 16;
|
||||
float[] lights = new float[size * size * 3];
|
||||
float[] lights = new float[size * size * 2];
|
||||
|
||||
for(int cx=-Chunk.RENDER_DISTANCE;cx<=Chunk.RENDER_DISTANCE;cx++) {
|
||||
for(int cy=-Chunk.RENDER_DISTANCE;cy<=Chunk.RENDER_DISTANCE;cy++)
|
||||
|
|
@ -115,14 +115,11 @@ public class DisplayLighting
|
|||
ft.tile.getLightLevel(ft, tpos),
|
||||
bt.tile.getLightLevel(bt, tpos));
|
||||
|
||||
float lightSun = ft.tile.passNaturalLight && bt.tile.passNaturalLight ? 1 : 0;
|
||||
|
||||
int id = ((cx * 16 + x + Chunk.RENDER_DISTANCE * 16) +
|
||||
(cy * 16 + y + Chunk.RENDER_DISTANCE * 16) * size) * 3;
|
||||
(cy * 16 + y + Chunk.RENDER_DISTANCE * 16) * size) * 2;
|
||||
|
||||
lights[id+0] = lightSun;
|
||||
lights[id+1] = lightSrc;
|
||||
lights[id+2] = transparency;
|
||||
lights[id+0] = lightSrc;
|
||||
lights[id+1] = transparency;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -259,7 +256,7 @@ public class DisplayLighting
|
|||
|
||||
if(lighting_new)
|
||||
{
|
||||
for(int i=0;i<lighting.p.length/4;i++)
|
||||
for(int i=0;i<lighting.p.length/3;i++)
|
||||
{
|
||||
int x = i % lighting.w;
|
||||
int y = i / lighting.w;
|
||||
|
|
@ -267,8 +264,7 @@ public class DisplayLighting
|
|||
Vec2i tpos = new Vec2i(x + lighting.x * 16, y + lighting.y * 16);
|
||||
|
||||
// Store light level data from the image
|
||||
layer.setDaylightLevel(lighting.p[i*4+0], tpos);
|
||||
layer.setLightLevel(lighting.p[i*4+1], tpos);
|
||||
layer.setLightLevel(lighting.p[i*3+1], tpos);
|
||||
}
|
||||
|
||||
lighting_new = false;
|
||||
|
|
@ -285,8 +281,8 @@ public class DisplayLighting
|
|||
|
||||
if(lighting_last_x != lighting.w || lighting_last_y != lighting.h)
|
||||
{
|
||||
GL33.glTexImage2D(GL33.GL_TEXTURE_2D, 0, GL33.GL_RGBA,
|
||||
lighting.w, lighting.h, 0, GL33.GL_RGBA, GL33.GL_UNSIGNED_BYTE, pixels_b);
|
||||
GL33.glTexImage2D(GL33.GL_TEXTURE_2D, 0, GL33.GL_RGB,
|
||||
lighting.w, lighting.h, 0, GL33.GL_RGB, GL33.GL_UNSIGNED_BYTE, pixels_b);
|
||||
|
||||
lighting_last_x = lighting.w;
|
||||
lighting_last_y = lighting.h;
|
||||
|
|
@ -294,7 +290,7 @@ public class DisplayLighting
|
|||
|
||||
else {
|
||||
GL33.glTexSubImage2D(GL33.GL_TEXTURE_2D, 0, 0, 0,
|
||||
lighting.w, lighting.h, GL33.GL_RGBA, GL33.GL_UNSIGNED_BYTE, pixels_b);
|
||||
lighting.w, lighting.h, GL33.GL_RGB, GL33.GL_UNSIGNED_BYTE, pixels_b);
|
||||
}
|
||||
|
||||
GL33.glGenerateMipmap(GL33.GL_TEXTURE_2D);
|
||||
|
|
@ -331,11 +327,10 @@ public class DisplayLighting
|
|||
int x = nl.get("x").getInteger();
|
||||
int y = nl.get("y").getInteger();
|
||||
|
||||
float[] pixels = new float[width*height*4];
|
||||
float[] pixels = new float[width*height*3];
|
||||
|
||||
for(int i=0;i<width*height;i++) {
|
||||
pixels[i*4+0] = light[i*2+0];
|
||||
pixels[i*4+1] = light[i*2+1];
|
||||
pixels[i*3] = light[i];
|
||||
}
|
||||
|
||||
Lighting lighting = new Lighting();
|
||||
|
|
@ -350,12 +345,12 @@ public class DisplayLighting
|
|||
for(int x2=0;x2<lighting.w;x2++) {
|
||||
for(int y2=0;y2<lighting.h;y2++)
|
||||
{
|
||||
int i = (x2 + y2 * lighting.w) * 4;
|
||||
int i = (x2 + y2 * lighting.w) * 3;
|
||||
|
||||
// Send temperature and humidity data to the image
|
||||
pixels[i+2] = (float)layer.layergen.getTemperatureStatic(
|
||||
pixels[i+1] = (float)layer.layergen.getTemperatureStatic(
|
||||
layer, new Vec2d(x2 + lighting.x * 16, y2 + lighting.y * 16));
|
||||
pixels[i+3] = (float)layer.layergen.getHumidity(
|
||||
pixels[i+2] = (float)layer.layergen.getHumidity(
|
||||
layer, new Vec2d(x2 + lighting.x * 16, y2 + lighting.y * 16));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,15 +9,11 @@ import java.nio.ByteBuffer;
|
|||
|
||||
import org.lwjgl.opengl.GL33;
|
||||
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.matrix.Matrix4;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.settings.SettingQuality;
|
||||
import projectzombie.util.math.ColorRange;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.chunk.ChunkEventHandler;
|
||||
import projectzombie.world.layer.layergen.LayerGen;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import org.lwjgl.opengl.GL33;
|
|||
import gl_engine.MathHelpers;
|
||||
import gl_engine.matrix.Matrix4;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import gl_engine.vec.Vec3i;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.inventory.Inventory;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import java.lang.reflect.InvocationTargetException;
|
|||
import java.util.Random;
|
||||
|
||||
import bdf.classes.IBdfClassManager;
|
||||
import bdf.types.BdfArray;
|
||||
import bdf.types.BdfNamedList;
|
||||
import bdf.types.BdfObject;
|
||||
import gl_engine.MathHelpers;
|
||||
|
|
@ -126,19 +125,17 @@ public abstract class Entity implements IBdfClassManager
|
|||
}
|
||||
|
||||
public Entity(BdfObject bdf) {
|
||||
this.BdfClassLoad(bdf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void BdfClassLoad(BdfObject bdf) {
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
BdfArray e = nl.get("e").getArray();
|
||||
pos = new Vec3d(e.get(0));
|
||||
velocity = new Vec3d(e.get(1));
|
||||
hitbox = e.get(2).getDouble();
|
||||
isSolid = e.get(3).getBoolean();
|
||||
emitsLight = e.get(6).getBoolean();
|
||||
hasGravity = e.get(8).getBoolean();
|
||||
pos = new Vec3d(nl.get("pos"));
|
||||
velocity = new Vec3d(nl.get("velocity"));
|
||||
hitbox = nl.get("hitbox").getDouble();
|
||||
isSolid = nl.get("isSolid").getBoolean();
|
||||
emitsLight = nl.get("emitsLight").getBoolean();
|
||||
hasGravity = nl.get("hasGravity").getBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -149,20 +146,20 @@ public abstract class Entity implements IBdfClassManager
|
|||
if(id == -1) return;
|
||||
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
nl.set("id", BdfObject.withInteger(getID()));
|
||||
nl.set("id", bdf.newObject().setInteger(getID()));
|
||||
|
||||
BdfObject pos_bdf = new BdfObject();
|
||||
BdfObject pos_bdf = bdf.newObject();
|
||||
pos.BdfClassSave(pos_bdf);
|
||||
|
||||
BdfObject velocity_bdf = new BdfObject();
|
||||
BdfObject velocity_bdf = bdf.newObject();
|
||||
velocity.BdfClassSave(velocity_bdf);
|
||||
|
||||
nl.set("pos", pos_bdf);
|
||||
nl.set("velocity", velocity_bdf);
|
||||
nl.set("hitbox", BdfObject.withDouble(hitbox));
|
||||
nl.set("isSolid", BdfObject.withBoolean(isSolid));
|
||||
nl.set("emitsLight", BdfObject.withBoolean(emitsLight));
|
||||
nl.set("hasGravity", BdfObject.withBoolean(hasGravity));
|
||||
nl.set("hitbox", bdf.newObject().setDouble(hitbox));
|
||||
nl.set("isSolid", bdf.newObject().setBoolean(isSolid));
|
||||
nl.set("emitsLight", bdf.newObject().setBoolean(emitsLight));
|
||||
nl.set("hasGravity", bdf.newObject().setBoolean(hasGravity));
|
||||
}
|
||||
|
||||
public void tick(Chunk chunk, Layer layer)
|
||||
|
|
@ -206,7 +203,7 @@ public abstract class Entity implements IBdfClassManager
|
|||
|
||||
if(new_pos.y > 0) {
|
||||
pos.y = new_pos.y;
|
||||
} else {
|
||||
} else if(pos.y >= 0) {
|
||||
velocity.y *= -0.25;
|
||||
velocity.x *= slipperiness;
|
||||
velocity.z *= slipperiness;
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ public class EntityBoss extends Entity implements IBossBar, EntityKillWithPartic
|
|||
|
||||
public EntityBoss(BdfObject bdf) {
|
||||
super(bdf);
|
||||
|
||||
BdfClassLoad(bdf);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -72,10 +74,10 @@ public class EntityBoss extends Entity implements IBossBar, EntityKillWithPartic
|
|||
super.BdfClassSave(bdf);
|
||||
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
nl.set("health", BdfObject.withDouble(health));
|
||||
nl.set("bullet_freq", BdfObject.withInteger(bullet_frequency));
|
||||
nl.set("spawn_freq", BdfObject.withInteger(spawn_frequency));
|
||||
nl.set("seed", BdfObject.withLong(seed));
|
||||
nl.set("health", bdf.newObject().setDouble(health));
|
||||
nl.set("bullet_freq", bdf.newObject().setInteger(bullet_frequency));
|
||||
nl.set("spawn_freq", bdf.newObject().setInteger(spawn_frequency));
|
||||
nl.set("seed", bdf.newObject().setLong(seed));
|
||||
}
|
||||
|
||||
public EntityBoss(Vec3d pos, Vec3d velocity) {
|
||||
|
|
|
|||
|
|
@ -7,10 +7,8 @@ import gl_engine.vec.Vec2d;
|
|||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.entity.particle.ParticleBlood;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.init.Resources;
|
||||
import projectzombie.init.Sounds;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.tiles.Tile;
|
||||
import projectzombie.tiles.TileBulletBreakable;
|
||||
import projectzombie.util.math.random.RandomHelpers;
|
||||
|
|
@ -28,6 +26,8 @@ public class EntityBullet extends EntityParticle
|
|||
|
||||
public EntityBullet(BdfObject bdf) {
|
||||
super(bdf);
|
||||
|
||||
BdfClassLoad(bdf);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -44,8 +44,8 @@ public class EntityBullet extends EntityParticle
|
|||
super.BdfClassSave(bdf);
|
||||
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
nl.set("time", BdfObject.withInteger(time));
|
||||
nl.set("damage", BdfObject.withDouble(damage));
|
||||
nl.set("time", bdf.newObject().setInteger(time));
|
||||
nl.set("damage", bdf.newObject().setDouble(damage));
|
||||
}
|
||||
|
||||
public EntityBullet(Vec3d pos, Vec3d velocity, Entity parent, double damage, int despawn_time) {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ public class EntityContainer extends Entity implements EntityHoldsEntities
|
|||
|
||||
public EntityContainer(BdfObject bdf) {
|
||||
super(bdf);
|
||||
|
||||
BdfClassLoad(bdf);
|
||||
}
|
||||
|
||||
public EntityContainer(Vec3d pos, Vec3d velocity, Entity[] entities) {
|
||||
|
|
@ -77,9 +79,9 @@ public class EntityContainer extends Entity implements EntityHoldsEntities
|
|||
super.BdfClassSave(bdf);
|
||||
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
BdfArray array = new BdfArray();
|
||||
BdfArray array = bdf.newArray();
|
||||
|
||||
nl.set("entities", BdfObject.withArray(array));
|
||||
nl.set("entities", bdf.newObject().setArray(array));
|
||||
|
||||
for(int i=0;i<entities.length;i++)
|
||||
{
|
||||
|
|
@ -89,7 +91,7 @@ public class EntityContainer extends Entity implements EntityHoldsEntities
|
|||
continue;
|
||||
}
|
||||
|
||||
BdfObject e_bdf = new BdfObject();
|
||||
BdfObject e_bdf = bdf.newObject();
|
||||
e.BdfClassSave(e_bdf);
|
||||
|
||||
array.add(e_bdf);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ public class EntityDummy extends Entity implements EntityAlive
|
|||
{
|
||||
public EntityDummy(BdfObject bdf) {
|
||||
super(bdf);
|
||||
|
||||
BdfClassLoad(bdf);
|
||||
}
|
||||
|
||||
public EntityDummy(Vec3d pos, Vec3d velocity) {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ public class EntityExplosion extends Entity
|
|||
|
||||
public EntityExplosion(BdfObject bdf) {
|
||||
super(bdf);
|
||||
|
||||
BdfClassLoad(bdf);
|
||||
}
|
||||
|
||||
public EntityExplosion(Vec3d pos, int radius, double damage) {
|
||||
|
|
@ -46,8 +48,8 @@ public class EntityExplosion extends Entity
|
|||
super.BdfClassSave(bdf);
|
||||
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
nl.set("damage", BdfObject.withDouble(damage));
|
||||
nl.set("radius", BdfObject.withInteger(radius));
|
||||
nl.set("damage", bdf.newObject().setDouble(damage));
|
||||
nl.set("radius", bdf.newObject().setInteger(radius));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ public class EntityGrapplingHook extends Entity
|
|||
|
||||
public EntityGrapplingHook(BdfObject bdf) {
|
||||
super(bdf);
|
||||
|
||||
BdfClassLoad(bdf);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -35,8 +37,8 @@ public class EntityGrapplingHook extends Entity
|
|||
super.BdfClassSave(bdf);
|
||||
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
nl.set("layer", BdfObject.withInteger(layerId));
|
||||
nl.set("height", BdfObject.withDouble(height));
|
||||
nl.set("layer", bdf.newObject().setInteger(layerId));
|
||||
nl.set("height", bdf.newObject().setDouble(height));
|
||||
}
|
||||
|
||||
public EntityGrapplingHook(Vec3d pos, int layerId, Entity entity) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package projectzombie.entity;
|
||||
|
||||
import projectzombie.inventory.IInventoryArmor;
|
||||
import projectzombie.inventory.InventoryArmor;
|
||||
|
||||
public interface EntityHasArmor {
|
||||
public IInventoryArmor getInventoryArmor();
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
package projectzombie.entity;
|
||||
|
||||
import projectzombie.inventory.IInventoryClothing;
|
||||
import projectzombie.inventory.InventoryArmor;
|
||||
import projectzombie.inventory.InventoryClothing;
|
||||
|
||||
public interface EntityHasClothing {
|
||||
public IInventoryClothing getInventoryClothing();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package projectzombie.entity;
|
||||
|
||||
import projectzombie.inventory.IInventory;
|
||||
import projectzombie.inventory.Inventory;
|
||||
|
||||
public interface EntityHasInventory
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import bdf.types.BdfNamedList;
|
|||
import bdf.types.BdfObject;
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
|
|
@ -18,6 +17,8 @@ public class EntityItem extends EntityParticle
|
|||
|
||||
public EntityItem(BdfObject bdf) {
|
||||
super(bdf);
|
||||
|
||||
BdfClassLoad(bdf);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -40,8 +41,8 @@ public class EntityItem extends EntityParticle
|
|||
|
||||
stack.BdfClassSave(nl.get("stack"));
|
||||
|
||||
nl.set("pickup", BdfObject.withInteger(pickup_time));
|
||||
nl.set("age", BdfObject.withLong(age));
|
||||
nl.set("pickup", bdf.newObject().setInteger(pickup_time));
|
||||
nl.set("age", bdf.newObject().setLong(age));
|
||||
}
|
||||
|
||||
public EntityItem(Vec3d pos, Vec3d velocity, ItemStack stack, double angle) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ public class EntityTnt extends Entity implements EntityHoldsEntities
|
|||
public EntityTnt(BdfObject bdf) {
|
||||
super(bdf);
|
||||
|
||||
this.smoke_particles = new ParticleSmokeTrail(this);
|
||||
smoke_particles = new ParticleSmokeTrail(this);
|
||||
BdfClassLoad(bdf);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -47,9 +48,9 @@ public class EntityTnt extends Entity implements EntityHoldsEntities
|
|||
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
BdfNamedList explode = nl.get("explosion").getNamedList();
|
||||
explode.set("time", BdfObject.withInteger(explode_time));
|
||||
explode.set("radius", BdfObject.withInteger(explode_radius));
|
||||
explode.set("damage", BdfObject.withDouble(explode_damage));
|
||||
explode.set("time", bdf.newObject().setInteger(explode_time));
|
||||
explode.set("radius", bdf.newObject().setInteger(explode_radius));
|
||||
explode.set("damage", bdf.newObject().setDouble(explode_damage));
|
||||
}
|
||||
|
||||
public EntityTnt(Vec3d pos, Vec3d velocity, double angle, int explode_radius, double explode_damage) {
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ public class EntityZombie extends Entity implements EntityAlive, EntityKillWithP
|
|||
// Set some settings
|
||||
hitbox = 0.5;
|
||||
isSolid = true;
|
||||
|
||||
BdfClassLoad(bdf);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -71,11 +73,11 @@ public class EntityZombie extends Entity implements EntityAlive, EntityKillWithP
|
|||
super.BdfClassSave(bdf);
|
||||
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
nl.set("max_health", BdfObject.withDouble(health_max));
|
||||
nl.set("health", BdfObject.withDouble(health));
|
||||
nl.set("gun_interval", BdfObject.withInteger(gun_interval));
|
||||
nl.set("gun_level", BdfObject.withInteger(gun_level));
|
||||
nl.set("seed", BdfObject.withLong(seed));
|
||||
nl.set("max_health", bdf.newObject().setDouble(health_max));
|
||||
nl.set("health", bdf.newObject().setDouble(health));
|
||||
nl.set("gun_interval", bdf.newObject().setInteger(gun_interval));
|
||||
nl.set("gun_level", bdf.newObject().setInteger(gun_level));
|
||||
nl.set("seed", bdf.newObject().setLong(seed));
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package projectzombie.entity.particle;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.texture.TextureRef3D;
|
||||
import gl_engine.vec.Vec2d;
|
||||
|
|
@ -10,7 +8,6 @@ import projectzombie.entity.Entity;
|
|||
import projectzombie.entity.EntityParticle;
|
||||
import projectzombie.entity.EntityParticlePart;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.util.math.comparator.Comparators;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package projectzombie.entity.particle;
|
||||
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.entity.particle.ParticleBreak.Break;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.IModel;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,27 +8,22 @@ import gl_engine.MathHelpers;
|
|||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import mainloop.task.IMainloopTask;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.display.DisplayLighting;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.entity.EntityAlive;
|
||||
import projectzombie.entity.EntityBullet;
|
||||
import projectzombie.entity.EntityHasArmor;
|
||||
import projectzombie.entity.EntityHasClothing;
|
||||
import projectzombie.entity.EntityHasTasks;
|
||||
import projectzombie.entity.EntityHasInventory;
|
||||
import projectzombie.entity.EntityHasTasks;
|
||||
import projectzombie.entity.EntityItem;
|
||||
import projectzombie.entity.particle.ParticleBreak;
|
||||
import projectzombie.init.Items;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.init.Tasks;
|
||||
import projectzombie.init.Tiles;
|
||||
import projectzombie.inventory.Inventory;
|
||||
import projectzombie.inventory.InventoryArmor;
|
||||
import projectzombie.inventory.InventoryClothing;
|
||||
import projectzombie.items.ItemTool;
|
||||
import projectzombie.menu.MenuDeath;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.model.ModelPlayer;
|
||||
import projectzombie.settings.Cheats;
|
||||
|
|
@ -73,7 +68,7 @@ public class EntityPlayer extends Entity implements
|
|||
|
||||
public EntityPlayer(BdfObject bdf) {
|
||||
super(bdf);
|
||||
tasks = new ArrayList<Task>();
|
||||
BdfClassLoad(bdf);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -88,6 +83,9 @@ public class EntityPlayer extends Entity implements
|
|||
angle = nl.get("angle").getDouble();
|
||||
temperature = nl.get("temperature").getDouble();
|
||||
hydration = nl.get("hydration").getDouble();
|
||||
in_animation = nl.get("inAnimation").getBoolean();
|
||||
moving = nl.get("moving").getBoolean();
|
||||
inventory_hand = nl.get("hand").getInteger();
|
||||
|
||||
tasks = new ArrayList<Task>();
|
||||
|
||||
|
|
@ -106,15 +104,18 @@ public class EntityPlayer extends Entity implements
|
|||
public void BdfClassSave(BdfObject bdf) {
|
||||
super.BdfClassSave(bdf);
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
nl.set("health", BdfObject.withDouble(health));
|
||||
nl.set("dead", BdfObject.withBoolean(dead));
|
||||
nl.set("health", bdf.newObject().setDouble(health));
|
||||
nl.set("dead", bdf.newObject().setBoolean(dead));
|
||||
inventory.BdfClassSave(nl.get("inventory"));
|
||||
armor.BdfClassSave(nl.get("armor"));
|
||||
clothing.BdfClassSave(nl.get("clothing"));
|
||||
nl.set("angle", BdfObject.withDouble(angle));
|
||||
nl.set("temperature", BdfObject.withDouble(temperature));
|
||||
nl.set("hydration", BdfObject.withDouble(hydration));
|
||||
nl.set("tasks", Task.saveTasks(tasks.toArray(new Task[0])));
|
||||
nl.set("angle", bdf.newObject().setDouble(angle));
|
||||
nl.set("temperature", bdf.newObject().setDouble(temperature));
|
||||
nl.set("hydration", bdf.newObject().setDouble(hydration));
|
||||
nl.set("tasks", Task.saveTasks(bdf.newObject(), tasks.toArray(new Task[0])));
|
||||
nl.set("inAnimation", bdf.newObject().setBoolean(in_animation));
|
||||
nl.set("moving", bdf.newObject().setBoolean(moving));
|
||||
nl.set("hand", bdf.newObject().setInteger(inventory_hand));
|
||||
}
|
||||
|
||||
public EntityPlayer() {
|
||||
|
|
@ -133,8 +134,6 @@ public class EntityPlayer extends Entity implements
|
|||
inventory = new Inventory(42);
|
||||
armor = new InventoryArmor();
|
||||
clothing = new InventoryClothing();
|
||||
|
||||
clothing.setShirt(new ItemStack(Items.SPAWN_ZOMBIE, 99, (short)0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,37 +1,9 @@
|
|||
package projectzombie.init;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import projectzombie.Main;
|
||||
import projectzombie.display.bossbar.BossBars;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.time.GameTimer;
|
||||
import projectzombie.world.World;
|
||||
import projectzombie.world.layer.Layer;
|
||||
import projectzombie.world.layer.layergen.LayerGenBossArena;
|
||||
|
||||
public class Layers
|
||||
{
|
||||
public static void createWorld(String path, long seed)
|
||||
{
|
||||
// Create all the layers
|
||||
EARTH = new Layer(new Random(seed), LayerGenerators.EARTH);
|
||||
CAVES = new Layer(new Random(seed), LayerGenerators.CAVES);
|
||||
LAVA_CAVES = new Layer(new Random(seed), LayerGenerators.LAVA_CAVES);
|
||||
|
||||
// Create the world and set the earth as the default layer
|
||||
Main.world = new World(path);
|
||||
Main.world.addLayer(EARTH);
|
||||
Main.world.addLayer(CAVES);
|
||||
Main.world.addLayer(LAVA_CAVES);
|
||||
Main.world.setLayer(0);
|
||||
|
||||
// Initialize some other objects
|
||||
Main.player = new EntityPlayer();
|
||||
GameTimer.resetTime();
|
||||
BossBars.clear();
|
||||
}
|
||||
|
||||
public static Layer EARTH;
|
||||
public static Layer CAVES;
|
||||
public static Layer LAVA_CAVES;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import projectzombie.model.ModelTile;
|
|||
import projectzombie.model.ModelTree;
|
||||
import projectzombie.model.ModelTreeSnow;
|
||||
import projectzombie.model.ModelVertical;
|
||||
import projectzombie.model.player.ModelPlayerHead;
|
||||
|
||||
public class Models
|
||||
{
|
||||
|
|
@ -94,6 +93,8 @@ public class Models
|
|||
new ModelVertical(Resources.ATLAS.get("/particle/smoke_4.png")),
|
||||
new ModelVertical(Resources.ATLAS.get("/particle/smoke_5.png")));
|
||||
|
||||
public static final ModelGui UI_PIXEL_WHITE = new ModelGui(Resources.ATLAS.get("/gui/pixel_white.png"));
|
||||
public static final ModelGui UI_PIXEL_BLACK = new ModelGui(Resources.ATLAS.get("/gui/pixel_black.png"));
|
||||
public static final ModelGui UI_BUTTON = new ModelGui(Resources.ATLAS.get("/gui/button_normal.png"), new Vec2d(12, 1.5));
|
||||
public static final ModelGui UI_BUTTON_HOVER = new ModelGui(Resources.ATLAS.get("/gui/button_hover.png"), new Vec2d(12, 1.5));
|
||||
public static final ModelGui UI_BUTTON_DELETE = new ModelGui(Resources.ATLAS.get("/gui/button_delete.png"), new Vec2d(1.875, 1.875));
|
||||
|
|
@ -101,6 +102,10 @@ public class Models
|
|||
public static final ModelGui UI_BUTTON_PLAY = new ModelGui(Resources.ATLAS.get("/gui/button_play.png"), new Vec2d(1.875, 1.875));
|
||||
public static final ModelGui UI_BUTTON_PLAY_HOVER = new ModelGui(Resources.ATLAS.get("/gui/button_play_hover.png"), new Vec2d(1.875, 1.875));
|
||||
public static final ModelGui UI_LABEL = new ModelGui(Resources.ATLAS.get("/gui/label.png"), new Vec2d(24, 3));
|
||||
public static final ModelGui UI_SELECTION_BOX_WIDE = new ModelGui(Resources.ATLAS.get("/gui/selection_box_wide.png"), new Vec2d(24, 12));
|
||||
public static final ModelGui UI_SELECTION_BOX_BIG = new ModelGui(Resources.ATLAS.get("/gui/selection_box_big.png"), new Vec2d(12, 12));
|
||||
public static final ModelGui UI_TEXT_BOX = new ModelGui(Resources.ATLAS.get("/gui/text_box.png"), new Vec2d(12, 1.5));
|
||||
public static final ModelGui UI_TEXT_CURSOR = new ModelGui(Resources.ATLAS.get("/gui/text_cursor.png"), 2, 50);
|
||||
|
||||
public static final ModelGui UI_HEALTH_FG = new ModelGui(Resources.ATLAS.get("/gui/health_full.png"), new Vec2d(6, 0.375));
|
||||
public static final ModelGui UI_HEALTH_BG = new ModelGui(Resources.ATLAS.get("/gui/health_empty.png"), new Vec2d(6, 0.375));
|
||||
|
|
|
|||
|
|
@ -11,11 +11,13 @@ public class CursorPosCallback implements GLFWCursorPosCallbackI
|
|||
{
|
||||
public static double mx, my;
|
||||
|
||||
public static Vec2d getCursorPos() {
|
||||
return new Vec2d(mx, my);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(long window, double x, double y)
|
||||
{
|
||||
Main.menu.input.mousePos(new Vec2d(x, y));
|
||||
|
||||
Main.window.setMouseVisibility(!Main.menu.keepMouse);
|
||||
InputMode.Controller = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,15 @@
|
|||
package projectzombie.input;
|
||||
|
||||
import static projectzombie.input.GameInput.*;
|
||||
import static projectzombie.input.GameInput.activateItem_last;
|
||||
import static projectzombie.input.GameInput.activate_last;
|
||||
import static projectzombie.input.GameInput.backButton_last;
|
||||
import static projectzombie.input.GameInput.dropItem_last;
|
||||
import static projectzombie.input.GameInput.hotbar_l;
|
||||
import static projectzombie.input.GameInput.hotbar_r;
|
||||
import static projectzombie.input.GameInput.moveDown;
|
||||
import static projectzombie.input.GameInput.moveUp;
|
||||
import static projectzombie.input.GameInput.move_last;
|
||||
import static projectzombie.input.GameInput.startButton_last;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
|
|
|
|||
|
|
@ -15,11 +15,20 @@ import static org.lwjgl.glfw.GLFW.GLFW_KEY_D;
|
|||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_E;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_F11;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_LEFT_CONTROL;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_Q;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_RIGHT_CONTROL;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_S;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_KEY_W;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_RELEASE;
|
||||
import static projectzombie.input.GameInput.*;
|
||||
import static projectzombie.input.GameInput.backButton_last;
|
||||
import static projectzombie.input.GameInput.buttonL;
|
||||
import static projectzombie.input.GameInput.buttonR;
|
||||
import static projectzombie.input.GameInput.moveDown;
|
||||
import static projectzombie.input.GameInput.moveLeft;
|
||||
import static projectzombie.input.GameInput.moveRight;
|
||||
import static projectzombie.input.GameInput.moveUp;
|
||||
import static projectzombie.input.GameInput.move_last;
|
||||
|
||||
import org.lwjgl.glfw.GLFWKeyCallbackI;
|
||||
|
||||
|
|
@ -27,7 +36,6 @@ import gl_engine.vec.Vec2d;
|
|||
import mainloop.task.IMainloopTask;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.input.types.Input;
|
||||
import projectzombie.menu.MenuInventory;
|
||||
|
||||
public class KeyCallback implements GLFWKeyCallbackI, IMainloopTask
|
||||
{
|
||||
|
|
@ -37,6 +45,8 @@ public class KeyCallback implements GLFWKeyCallbackI, IMainloopTask
|
|||
private boolean buttonL_last = false;
|
||||
private boolean buttonR_last = false;
|
||||
private boolean inventory_last = false;
|
||||
private boolean lctrl_pressed = false;
|
||||
private boolean rctrl_pressed = false;
|
||||
|
||||
@Override
|
||||
public void invoke(long window, int key, int scancode, int action, int mods)
|
||||
|
|
@ -46,6 +56,13 @@ public class KeyCallback implements GLFWKeyCallbackI, IMainloopTask
|
|||
|
||||
InputMode.Controller = false;
|
||||
|
||||
if(key == GLFW_KEY_LEFT_CONTROL) {
|
||||
lctrl_pressed = pressed;
|
||||
}
|
||||
if(key == GLFW_KEY_RIGHT_CONTROL) {
|
||||
rctrl_pressed = pressed;
|
||||
}
|
||||
|
||||
if(key == GLFW_KEY_W) {
|
||||
moveUp = pressed;
|
||||
}
|
||||
|
|
@ -62,36 +79,45 @@ public class KeyCallback implements GLFWKeyCallbackI, IMainloopTask
|
|||
moveRight = pressed;
|
||||
}
|
||||
|
||||
if(key == GLFW_KEY_1 && pressed) {
|
||||
if(pressed)
|
||||
{
|
||||
input.key(key);
|
||||
|
||||
if(lctrl_pressed || rctrl_pressed) {
|
||||
input.keyCtrl(key);
|
||||
}
|
||||
|
||||
if(key == GLFW_KEY_1) {
|
||||
input.hotbarGoto(true, 0);
|
||||
}
|
||||
if(key == GLFW_KEY_2 && pressed) {
|
||||
if(key == GLFW_KEY_2) {
|
||||
input.hotbarGoto(true, 1);
|
||||
}
|
||||
if(key == GLFW_KEY_3 && pressed) {
|
||||
if(key == GLFW_KEY_3) {
|
||||
input.hotbarGoto(true, 2);
|
||||
}
|
||||
if(key == GLFW_KEY_4 && pressed) {
|
||||
if(key == GLFW_KEY_4) {
|
||||
input.hotbarGoto(true, 3);
|
||||
}
|
||||
if(key == GLFW_KEY_5 && pressed) {
|
||||
if(key == GLFW_KEY_5) {
|
||||
input.hotbarGoto(true, 4);
|
||||
}
|
||||
if(key == GLFW_KEY_6 && pressed) {
|
||||
if(key == GLFW_KEY_6) {
|
||||
input.hotbarGoto(true, 5);
|
||||
}
|
||||
if(key == GLFW_KEY_7 && pressed) {
|
||||
if(key == GLFW_KEY_7) {
|
||||
input.hotbarGoto(true, 6);
|
||||
}
|
||||
if(key == GLFW_KEY_8 && pressed) {
|
||||
if(key == GLFW_KEY_8) {
|
||||
input.hotbarGoto(true, 7);
|
||||
}
|
||||
if(key == GLFW_KEY_9 && pressed) {
|
||||
if(key == GLFW_KEY_9) {
|
||||
input.hotbarGoto(true, 8);
|
||||
}
|
||||
if(key == GLFW_KEY_0 && pressed) {
|
||||
if(key == GLFW_KEY_0) {
|
||||
input.hotbarGoto(true, 9);
|
||||
}
|
||||
}
|
||||
|
||||
if(key == GLFW_KEY_Q) {
|
||||
if(pressed) {
|
||||
|
|
|
|||
|
|
@ -2,12 +2,15 @@ package projectzombie.input;
|
|||
|
||||
import org.lwjgl.glfw.GLFWCharCallbackI;
|
||||
|
||||
import projectzombie.Main;
|
||||
|
||||
public class KeyCharCallback implements GLFWCharCallbackI
|
||||
{
|
||||
|
||||
@Override
|
||||
public void invoke(long arg0, int arg1) {
|
||||
public void invoke(long window, int character) {
|
||||
InputMode.Controller = false;
|
||||
Main.menu.input.type((char)(character));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@ package projectzombie.input;
|
|||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.glfw.GLFWMouseButtonCallbackI;
|
||||
|
||||
import projectzombie.Main;
|
||||
|
||||
public class MouseButtonCallback implements GLFWMouseButtonCallbackI
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import gl_engine.vec.Vec2d;
|
|||
|
||||
public interface Input
|
||||
{
|
||||
public void type(char character);
|
||||
public void move(boolean state, double angle);
|
||||
public void fire(boolean state);
|
||||
public void camera(boolean state, double amount);
|
||||
|
|
@ -12,8 +13,9 @@ public interface Input
|
|||
public void pause(boolean state);
|
||||
public void hotbarGoto(boolean state, int pos);
|
||||
public void hotbarShift(boolean state, int amount);
|
||||
public void mousePos(Vec2d pos);
|
||||
public void back(boolean state);
|
||||
public void activate(boolean state);
|
||||
public void openInventory();
|
||||
public void key(int key);
|
||||
public void keyCtrl(int key);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,10 @@ public class InputGUI implements Input
|
|||
this.gui = gui;
|
||||
}
|
||||
|
||||
public GUI getGUI() {
|
||||
return gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void move(boolean state, double angle) {
|
||||
this.gui.onMove(state, angle);
|
||||
|
|
@ -61,15 +65,6 @@ public class InputGUI implements Input
|
|||
gui.onScroll(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePos(Vec2d pos)
|
||||
{
|
||||
double mx = (pos.x / Main.window.getWidth() * 20 - 10) * GlHelpers.getAspectRatio();
|
||||
double my = -pos.y / Main.window.getHeight() * 20 + 10;
|
||||
|
||||
this.gui.updateMousePos(new Vec2d(mx, my));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void back(boolean state) {
|
||||
gui.onBack();
|
||||
|
|
@ -84,4 +79,19 @@ public class InputGUI implements Input
|
|||
public void openInventory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void type(char character) {
|
||||
gui.type(character);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void key(int key) {
|
||||
gui.keyPress(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyCtrl(int key) {
|
||||
gui.keyPressCtrl(key);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
package projectzombie.input.types;
|
||||
|
||||
public interface InputGUITextBox {
|
||||
public void onBackspace();
|
||||
public void onDelete();
|
||||
public void onPressed(char character);
|
||||
public void onMoveCursor(int direction);
|
||||
public void setFocus(boolean focus);
|
||||
public void onPaste();
|
||||
public void onHome();
|
||||
public void onEnd();
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import gl_engine.vec.Vec2d;
|
|||
import projectzombie.Main;
|
||||
import projectzombie.menu.MenuGamePause;
|
||||
import projectzombie.menu.MenuInventory;
|
||||
import projectzombie.menu.MenuInventoryBasic;
|
||||
import projectzombie.world.chunk.ChunkEventHandler;
|
||||
|
||||
public class InputGame implements Input
|
||||
|
|
@ -66,10 +67,6 @@ public class InputGame implements Input
|
|||
Main.player.inventory_hand = MathHelpers.mod(Main.player.inventory_hand, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePos(Vec2d pos) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void back(boolean state) {
|
||||
}
|
||||
|
|
@ -80,7 +77,19 @@ public class InputGame implements Input
|
|||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
Main.menu = new MenuInventory(Main.menu);
|
||||
Main.menu = new MenuInventoryBasic(Main.menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void type(char character) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void key(int key) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyCtrl(int key) {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
package projectzombie.inventory;
|
||||
|
||||
public enum Crafting {
|
||||
BASIC
|
||||
}
|
||||
|
|
@ -158,11 +158,11 @@ public class Inventory implements IInventory, IBdfClassManager
|
|||
{
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
|
||||
nl.set("size", BdfObject.withInteger(items.length));
|
||||
nl.set("size", bdf.newObject().setInteger(items.length));
|
||||
BdfArray array = nl.get("items").getArray();
|
||||
|
||||
for(ItemStack stack : items) {
|
||||
BdfObject stack_bdf = new BdfObject();
|
||||
BdfObject stack_bdf = bdf.newObject();
|
||||
stack.BdfClassSave(stack_bdf);
|
||||
array.add(stack_bdf);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class InventoryArmor implements IBdfClassManager, IInventoryArmor
|
|||
|
||||
@Override
|
||||
public void BdfClassSave(BdfObject bdf) {
|
||||
BdfNamedList nl = new BdfNamedList();
|
||||
BdfNamedList nl = bdf.newNamedList();
|
||||
helmet.BdfClassSave(nl.get("helmet"));
|
||||
chest.BdfClassSave(nl.get("chest"));
|
||||
leggings.BdfClassSave(nl.get("leggings"));
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class InventoryClothing implements IBdfClassManager, IInventoryClothing
|
|||
|
||||
@Override
|
||||
public void BdfClassSave(BdfObject bdf) {
|
||||
BdfNamedList nl = new BdfNamedList();
|
||||
BdfNamedList nl = bdf.newNamedList();
|
||||
shirt.BdfClassSave(nl.get("shirt"));
|
||||
pants.BdfClassSave(nl.get("pants"));
|
||||
boots.BdfClassSave(nl.get("boots"));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
package projectzombie.inventory.recipe;
|
||||
|
||||
import projectzombie.inventory.Inventory;
|
||||
import projectzombie.inventory.Crafting;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
|
||||
public abstract class Recipe
|
||||
{
|
||||
public abstract ItemStack getResult();
|
||||
public abstract boolean canCraft(Crafting tool);
|
||||
public abstract boolean hasResourcesToCraft(Inventory inventory);
|
||||
public abstract ItemStack craftResult(Inventory inventory);
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package projectzombie.inventory.recipe;
|
||||
|
||||
import projectzombie.inventory.Crafting;
|
||||
import projectzombie.inventory.Inventory;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
|
||||
public class RecipeBasic extends Recipe
|
||||
{
|
||||
protected ItemStack[] stacks_required;
|
||||
protected Crafting[] tools_required;
|
||||
protected ItemStack result;
|
||||
|
||||
public RecipeBasic(ItemStack[] stacks_required, Crafting[] tools_required, ItemStack result)
|
||||
{
|
||||
this.stacks_required = stacks_required;
|
||||
this.tools_required = tools_required;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getResult() {
|
||||
return result.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(Crafting tool)
|
||||
{
|
||||
for(Crafting tool_required : tools_required) {
|
||||
if(tool == tool_required) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasResourcesToCraft(Inventory inventory)
|
||||
{
|
||||
for(ItemStack item : stacks_required) {
|
||||
if(inventory.getItemCount(item) < item.count) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack craftResult(Inventory inventory)
|
||||
{
|
||||
for(ItemStack item : stacks_required) {
|
||||
inventory.removeItem(item.copy());
|
||||
}
|
||||
|
||||
return result.copy();
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,6 @@ import projectzombie.entity.Entity;
|
|||
import projectzombie.entity.EntityHasInventory;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.inventory.IInventory;
|
||||
import projectzombie.inventory.Inventory;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
package projectzombie.items;
|
||||
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class ItemAmmo extends Item
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package projectzombie.items;
|
||||
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package projectzombie.items;
|
|||
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
|
||||
public class ItemFlint extends Item
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
package projectzombie.items;
|
||||
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class ItemRock extends Item implements ItemTool
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ package projectzombie.menu;
|
|||
|
||||
import projectzombie.Main;
|
||||
import projectzombie.input.types.InputGUI;
|
||||
import projectzombie.menu.gui.GUIButtonGroup;
|
||||
import projectzombie.menu.gui.GUIButtonGroupPause;
|
||||
import projectzombie.menu.gui.GUI;
|
||||
import projectzombie.menu.gui.GUIButtonBasic;
|
||||
import projectzombie.menu.gui.GUIButtonGroup;
|
||||
import projectzombie.menu.gui.GUIButtonGroupPause;
|
||||
|
||||
public class MenuDeath extends Menu
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,17 +1,13 @@
|
|||
package projectzombie.menu;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.zip.DeflaterOutputStream;
|
||||
|
||||
import bdf.types.BdfObject;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.input.types.InputGUI;
|
||||
import projectzombie.menu.gui.GUIButtonGroup;
|
||||
import projectzombie.menu.gui.GUIButtonGroupPause;
|
||||
import projectzombie.menu.gui.GUILabelPause;
|
||||
import projectzombie.menu.gui.GUI;
|
||||
import projectzombie.menu.gui.GUIBackToMenu;
|
||||
import projectzombie.menu.gui.GUIButtonBasic;
|
||||
import projectzombie.menu.gui.GUIButtonGroup;
|
||||
import projectzombie.menu.gui.GUIButtonGroupPause;
|
||||
import projectzombie.menu.gui.GUILabelPause;
|
||||
|
||||
public class MenuGamePause extends Menu
|
||||
{
|
||||
|
|
@ -44,48 +40,7 @@ public class MenuGamePause extends Menu
|
|||
|
||||
public void saveAndQuit()
|
||||
{
|
||||
long now, cur = 0;
|
||||
|
||||
BdfObject bdf = new BdfObject();
|
||||
|
||||
now = System.currentTimeMillis();
|
||||
Main.world.BdfClassSave(bdf);
|
||||
cur = System.currentTimeMillis();
|
||||
System.out.println("Time for BdfClassSave: " + (cur - now));
|
||||
now = cur;
|
||||
|
||||
System.out.println("Size on file: " + bdf.serialize().size());
|
||||
//System.out.println(bdf.serializeHumanReadable());
|
||||
|
||||
try {
|
||||
|
||||
/*
|
||||
|
||||
FileOutputStream os = new FileOutputStream("./layer.hbdf");
|
||||
os.write(bdf.serializeHumanReadable(new BdfIndent("\t", "\n")).getBytes());
|
||||
os.close();
|
||||
|
||||
cur = System.currentTimeMillis();
|
||||
System.out.println("Time for HBDF: " + (cur - now));
|
||||
now = cur;
|
||||
|
||||
*/
|
||||
|
||||
FileOutputStream os2 = new FileOutputStream("./layer.bdf");
|
||||
DeflaterOutputStream dos = new DeflaterOutputStream(os2);
|
||||
dos.write(bdf.serialize().getBytes());
|
||||
dos.close();
|
||||
os2.close();
|
||||
|
||||
cur = System.currentTimeMillis();
|
||||
System.out.println("Time for BDF: " + (cur - now));
|
||||
now = cur;
|
||||
}
|
||||
|
||||
catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Main.world.save();
|
||||
Main.menu = new MenuMain();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
package projectzombie.menu;
|
||||
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.matrix.Matrix4;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.init.Items;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.input.CursorPosCallback;
|
||||
import projectzombie.input.types.InputGUI;
|
||||
|
|
@ -15,24 +12,25 @@ import projectzombie.inventory.InventoryArmor;
|
|||
import projectzombie.inventory.InventoryClothing;
|
||||
import projectzombie.items.ItemArmor;
|
||||
import projectzombie.items.ItemClothing;
|
||||
import projectzombie.menu.gui.GUIButton;
|
||||
import projectzombie.menu.gui.GUI;
|
||||
import projectzombie.menu.gui.GUIBackToMenu;
|
||||
import projectzombie.menu.gui.GUIItemHolder;
|
||||
import projectzombie.menu.gui.GUIItemSlot;
|
||||
import projectzombie.menu.gui.GUIItemSlotGetter;
|
||||
import projectzombie.menu.gui.GUIItemSlotGetterStorage;
|
||||
import projectzombie.menu.gui.GUI;
|
||||
import projectzombie.menu.gui.GUIBackToMenu;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import projectzombie.model.ModelGui;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
|
||||
public class MenuInventory extends Menu
|
||||
public abstract class MenuInventory extends Menu
|
||||
{
|
||||
private Menu parent;
|
||||
private GUI gui;
|
||||
protected Menu parent;
|
||||
protected GUIItemHolder itemHolder;
|
||||
protected GUI gui;
|
||||
private GUI top_gui;
|
||||
|
||||
private GUIItemSlot[] item_slots;
|
||||
private GUIItemSlot[] armor_slots;
|
||||
protected GUIItemSlot[] item_slots;
|
||||
protected GUIItemSlot[] armor_slots;
|
||||
|
||||
public MenuInventory(Menu parent)
|
||||
{
|
||||
|
|
@ -44,12 +42,13 @@ public class MenuInventory extends Menu
|
|||
|
||||
keepMouse = false;
|
||||
|
||||
gui = new GUIBackToMenu(parent);
|
||||
input = new InputGUI(gui);
|
||||
top_gui = new GUIBackToMenu(parent);
|
||||
input = new InputGUI(top_gui);
|
||||
gui = new GUI();
|
||||
|
||||
Inventory inventory = Main.player.getInventory();
|
||||
GUIItemHolder itemHolder = new GUIItemHolder();
|
||||
|
||||
itemHolder = new GUIItemHolder();
|
||||
item_slots = new GUIItemSlot[42];
|
||||
armor_slots = new GUIItemSlot[6];
|
||||
|
||||
|
|
@ -185,9 +184,8 @@ public class MenuInventory extends Menu
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
gui.add(itemHolder);
|
||||
top_gui.add(gui);
|
||||
top_gui.add(itemHolder);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -230,14 +228,14 @@ public class MenuInventory extends Menu
|
|||
player_matrix = Matrix4.multiply(Matrix4.rotate(ay, 1, 0, 0), player_matrix);
|
||||
player_matrix = Matrix4.multiply(Matrix4.translate(-width * (10.8 / 256.0), -height * (10.8 / 256.0), 0), player_matrix);*/
|
||||
|
||||
gui.render();
|
||||
top_gui.render();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
||||
gui.update(new Vec2d(CursorPosCallback.mx, CursorPosCallback.my));
|
||||
top_gui.update(new Vec2d(CursorPosCallback.mx, CursorPosCallback.my));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
package projectzombie.menu;
|
||||
|
||||
import gl_engine.matrix.Matrix4;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.menu.gui.GUIContainerSlider;
|
||||
|
||||
public class MenuInventoryBasic extends MenuInventory
|
||||
{
|
||||
private GUIContainerSlider slider;
|
||||
|
||||
public MenuInventoryBasic(Menu parent) {
|
||||
super(parent);
|
||||
|
||||
slider = new GUIContainerSlider(new Vec2d(
|
||||
Models.UI_INVENTORY.getWidth() * 1 / 256.0,
|
||||
-Models.UI_INVENTORY.getHeight() * 127 / 256.0), new Vec2d(
|
||||
Models.UI_INVENTORY.getWidth() * 254 / 256.0,
|
||||
Models.UI_INVENTORY.getHeight() * 254 / 256.0), 100);
|
||||
|
||||
gui.add(slider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render()
|
||||
{
|
||||
Matrix4 matrix = Matrix4.translate(0, -Models.UI_INVENTORY.getHeight() / 2, 0);
|
||||
|
||||
// Render the inventory gui
|
||||
Models.UI_SELECTION_BOX_BIG.setModel(matrix);
|
||||
Models.UI_SELECTION_BOX_BIG.render();
|
||||
|
||||
super.render();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,14 +2,16 @@ package projectzombie.menu;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.init.Layers;
|
||||
import projectzombie.input.types.InputGUI;
|
||||
import projectzombie.menu.gui.GUIButtonGroup;
|
||||
import projectzombie.menu.gui.GUILabelMain;
|
||||
import projectzombie.menu.gui.GUI;
|
||||
import projectzombie.menu.gui.GUIButtonBasic;
|
||||
import projectzombie.menu.gui.GUIButtonGroup;
|
||||
import projectzombie.menu.gui.GUILabelMain;
|
||||
import projectzombie.menu.gui.GUITextBox;
|
||||
import projectzombie.world.World;
|
||||
|
||||
public class MenuMain extends Menu
|
||||
{
|
||||
|
|
@ -45,7 +47,7 @@ public class MenuMain extends Menu
|
|||
gui.add(group);
|
||||
gui.setSelected(group.get(0));
|
||||
|
||||
Layers.createWorld(null, rand.nextLong());
|
||||
World.createWorld(null, rand.nextLong());
|
||||
Main.player.dead = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,33 +1,51 @@
|
|||
package projectzombie.menu;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import org.lwjgl.opengl.GL33;
|
||||
|
||||
import bdf.file.BdfFileManager;
|
||||
import bdf.types.BdfArray;
|
||||
import bdf.types.BdfNamedList;
|
||||
import bdf.types.BdfObject;
|
||||
import gl_engine.matrix.Matrix4;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.init.Layers;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.input.types.InputGUI;
|
||||
import projectzombie.menu.gui.GUI;
|
||||
import projectzombie.menu.gui.GUIAlignment;
|
||||
import projectzombie.menu.gui.GUIButton;
|
||||
import projectzombie.menu.gui.GUIBackToMenu;
|
||||
import projectzombie.menu.gui.GUIButtonBasic;
|
||||
import projectzombie.menu.gui.GUIButtonCallback;
|
||||
import projectzombie.menu.gui.GUIContainerSlider;
|
||||
import projectzombie.menu.gui.GUILabel;
|
||||
import projectzombie.menu.gui.GUISavesCard;
|
||||
import projectzombie.menu.gui.GUIButtonModel;
|
||||
import projectzombie.menu.gui.GUIButtonSetting;
|
||||
import projectzombie.menu.gui.GUIContainerSlider;
|
||||
import projectzombie.model.ModelGui;
|
||||
import projectzombie.world.World;
|
||||
|
||||
public class MenuSaves extends Menu
|
||||
{
|
||||
private static final Random rand = new Random();
|
||||
|
||||
private BdfFileManager reader;
|
||||
private ArrayList<SaveCard> saves;
|
||||
private int saves_remove = -1;
|
||||
|
||||
private Menu parent;
|
||||
private GUIContainerSlider slider;
|
||||
private GUI gui;
|
||||
|
||||
private class SaveCard
|
||||
{
|
||||
String text, filename;
|
||||
|
||||
public SaveCard(String text, String filename)
|
||||
{
|
||||
this.text = text;
|
||||
this.filename = filename;
|
||||
}
|
||||
}
|
||||
|
||||
public MenuSaves(Menu parent)
|
||||
{
|
||||
this.parent = parent;
|
||||
|
|
@ -36,8 +54,8 @@ public class MenuSaves extends Menu
|
|||
doGameRender = parent.doGameRender;
|
||||
showIngameGUI = parent.showIngameGUI;
|
||||
|
||||
gui = new GUI();
|
||||
|
||||
gui = new GUIBackToMenu(parent);
|
||||
saves = new ArrayList<SaveCard>();
|
||||
|
||||
input = new InputGUI(gui);
|
||||
keepMouse = false;
|
||||
|
|
@ -47,14 +65,16 @@ public class MenuSaves extends Menu
|
|||
});
|
||||
|
||||
GUIButtonBasic buttonCreate = new GUIButtonBasic("Create", button -> {
|
||||
Layers.createWorld(null, rand.nextLong());
|
||||
Main.menu = new MenuGame();
|
||||
createWorld();
|
||||
});
|
||||
|
||||
slider = new GUIContainerSlider(new Vec2d(-20, -5), new Vec2d(40, 10), 10);
|
||||
slider = new GUIContainerSlider(new Vec2d(
|
||||
-Models.UI_SELECTION_BOX_WIDE.getWidth() * 127 / 256.0,
|
||||
-Models.UI_SELECTION_BOX_WIDE.getHeight() * 63 / 128.0), new Vec2d(
|
||||
Models.UI_SELECTION_BOX_WIDE.getWidth() * 254 / 256.0,
|
||||
Models.UI_SELECTION_BOX_WIDE.getHeight() * 126 / 128.0), 10);
|
||||
|
||||
GUISavesCard savesCard = new GUISavesCard(new Vec2d(0, 0));
|
||||
slider.add(savesCard);
|
||||
reloadDatabase();
|
||||
|
||||
buttonBack.setAlign(GUIAlignment.RIGHT);
|
||||
buttonCreate.setAlign(GUIAlignment.LEFT);
|
||||
|
|
@ -73,9 +93,99 @@ public class MenuSaves extends Menu
|
|||
gui.add(slider);
|
||||
}
|
||||
|
||||
private void createWorld() {
|
||||
Main.menu = new MenuWorldNew(this);
|
||||
}
|
||||
|
||||
private void loadSave(int index)
|
||||
{
|
||||
BdfObject bdf = reader.getObject();
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
BdfArray array = nl.get("saves").getArray();
|
||||
|
||||
BdfObject save_bdf = array.remove(index);
|
||||
array.add(save_bdf);
|
||||
|
||||
reader.saveDatabase();
|
||||
|
||||
Main.world = new World(saves.get(index).filename);
|
||||
Main.menu = new MenuGame();
|
||||
}
|
||||
|
||||
private void deleteSave(int index)
|
||||
{
|
||||
SaveCard save = saves.get(index);
|
||||
Main.menu = new MenuWorldDelete(this, save.text, save.filename);
|
||||
}
|
||||
|
||||
public void reloadDatabase()
|
||||
{
|
||||
saves.clear();
|
||||
reader = new BdfFileManager("./saves.bdf", true);
|
||||
BdfNamedList nl = reader.getObject().getNamedList();
|
||||
BdfArray array = nl.get("saves").getArray();
|
||||
|
||||
for(BdfObject save_bdf : array)
|
||||
{
|
||||
BdfNamedList save_nl = save_bdf.getNamedList();
|
||||
|
||||
SaveCard save = new SaveCard(
|
||||
save_nl.get("name").getString(),
|
||||
save_nl.get("path").getString());
|
||||
|
||||
saves.add(save);
|
||||
}
|
||||
|
||||
generateSaveCards();
|
||||
}
|
||||
|
||||
private void generateSaveCards()
|
||||
{
|
||||
double slider_length = Models.UI_LABEL.getHeight() * 18.0 * saves.size() / 16.0;
|
||||
double selection_length = Models.UI_SELECTION_BOX_WIDE.getHeight() * 248 / 256.0;
|
||||
|
||||
slider.clear();
|
||||
slider.setLength(slider_length > selection_length ? slider_length - selection_length : 0);
|
||||
|
||||
for(int i=0;i<saves.size();i++)
|
||||
{
|
||||
int[] index = {saves.size() - i - 1};
|
||||
SaveCard save = saves.get(index[0]);
|
||||
|
||||
GUISavesCard savesCard = new GUISavesCard(save.text, new Vec2d(
|
||||
-Models.UI_LABEL.getWidth() / 2.0,
|
||||
-Models.UI_LABEL.getHeight() +
|
||||
Models.UI_SELECTION_BOX_WIDE.getHeight() * 60.0 / 128.0 -
|
||||
Models.UI_LABEL.getHeight() * 18.0 * i / 16.0))
|
||||
{
|
||||
@Override
|
||||
public void onDeletePressed() {
|
||||
super.onDeletePressed();
|
||||
|
||||
deleteSave(index[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayPressed() {
|
||||
super.onPlayPressed();
|
||||
|
||||
loadSave(index[0]);
|
||||
}
|
||||
};
|
||||
|
||||
slider.add(savesCard);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render()
|
||||
{
|
||||
ModelGui selection_box = Models.UI_SELECTION_BOX_WIDE;
|
||||
selection_box.setModel(Matrix4.translate(
|
||||
-selection_box.getWidth() / 2,
|
||||
-selection_box.getHeight() / 2, 0));
|
||||
selection_box.render();
|
||||
|
||||
gui.render();
|
||||
}
|
||||
|
||||
|
|
@ -83,7 +193,6 @@ public class MenuSaves extends Menu
|
|||
public void update()
|
||||
{
|
||||
parent.update();
|
||||
|
||||
super.update();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,16 +5,15 @@ import projectzombie.Main;
|
|||
import projectzombie.display.DisplayRender;
|
||||
import projectzombie.display.DisplayRenderUI;
|
||||
import projectzombie.display.DisplayWindow;
|
||||
import projectzombie.entity.EntityParticle;
|
||||
import projectzombie.input.types.InputGUI;
|
||||
import projectzombie.menu.gui.GUI;
|
||||
import projectzombie.menu.gui.GUIBackToMenu;
|
||||
import projectzombie.menu.gui.GUIButton;
|
||||
import projectzombie.menu.gui.GUIButtonBasic;
|
||||
import projectzombie.menu.gui.GUIButtonGroup;
|
||||
import projectzombie.menu.gui.GUIButtonSetting;
|
||||
import projectzombie.menu.gui.GUI;
|
||||
import projectzombie.menu.gui.GUIBackToMenu;
|
||||
import projectzombie.menu.gui.GUISelectableDirection;
|
||||
import projectzombie.menu.gui.GUILabel;
|
||||
import projectzombie.menu.gui.GUISelectableDirection;
|
||||
import projectzombie.settings.SettingQuality;
|
||||
import projectzombie.settings.Settings;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,116 @@
|
|||
package projectzombie.menu;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import bdf.file.BdfFileManager;
|
||||
import bdf.types.BdfArray;
|
||||
import bdf.types.BdfNamedList;
|
||||
import bdf.types.BdfObject;
|
||||
import bdf.types.BdfReader;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.input.types.InputGUI;
|
||||
import projectzombie.menu.gui.GUI;
|
||||
import projectzombie.menu.gui.GUIAlignment;
|
||||
import projectzombie.menu.gui.GUIBackToMenu;
|
||||
import projectzombie.menu.gui.GUIButtonBasic;
|
||||
import projectzombie.menu.gui.GUILabel;
|
||||
import projectzombie.menu.gui.GUITextBox;
|
||||
|
||||
public class MenuWorldDelete extends Menu
|
||||
{
|
||||
|
||||
private MenuSaves parent;
|
||||
private String name;
|
||||
private String path;
|
||||
|
||||
private GUI gui;
|
||||
|
||||
public MenuWorldDelete(MenuSaves parent, String name, String path)
|
||||
{
|
||||
this.parent = parent;
|
||||
this.name = name;
|
||||
this.path = path;
|
||||
|
||||
keepMouse = false;
|
||||
|
||||
doGameloop = parent.doGameloop;
|
||||
doGameRender = parent.doGameRender;
|
||||
showIngameGUI = parent.showIngameGUI;
|
||||
|
||||
gui = new GUIBackToMenu(parent);
|
||||
input = new InputGUI(gui);
|
||||
|
||||
GUIButtonBasic buttonCancel = new GUIButtonBasic("Cancel", button -> {
|
||||
Main.menu = parent;
|
||||
});
|
||||
|
||||
GUIButtonBasic buttonDelete = new GUIButtonBasic("Delete", button -> {
|
||||
deleteSave();
|
||||
});
|
||||
|
||||
buttonCancel.setAlign(GUIAlignment.RIGHT);
|
||||
buttonDelete.setAlign(GUIAlignment.LEFT);
|
||||
|
||||
buttonCancel.setPos(new Vec2d(-0.5, -4));
|
||||
buttonDelete.setPos(new Vec2d(0.5, -4));
|
||||
|
||||
{
|
||||
// Delete world title
|
||||
GUILabel label = new GUILabel();
|
||||
label.setText("Delete World");
|
||||
label.setSize(new Vec2d(1, 1));
|
||||
label.setPos(new Vec2d(0, 4));
|
||||
gui.add(label);
|
||||
}
|
||||
|
||||
{
|
||||
// Delete world confirm message
|
||||
GUILabel label = new GUILabel();
|
||||
label.setText("Are you sure you want to delete \"" + name + "\"?");
|
||||
label.setSize(new Vec2d(0.4, 0.4));
|
||||
label.setPos(new Vec2d(0, 3));
|
||||
gui.add(label);
|
||||
}
|
||||
|
||||
gui.add(buttonCancel);
|
||||
gui.add(buttonDelete);
|
||||
}
|
||||
|
||||
private void deleteSave()
|
||||
{
|
||||
BdfFileManager reader = new BdfFileManager("./saves.bdf", true);
|
||||
BdfObject bdf = reader.getObject();
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
BdfArray array = nl.get("saves").getArray();
|
||||
|
||||
File save_file = new File("./saves/" + path + ".bdf");
|
||||
save_file.delete();
|
||||
|
||||
for(int i=0;i<array.size();i++) {
|
||||
BdfNamedList world_nl = array.get(i).getNamedList();
|
||||
if(world_nl.get("path").getString().contentEquals(path)) {
|
||||
array.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Main.menu = parent;
|
||||
|
||||
reader.saveDatabase();
|
||||
parent.reloadDatabase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
gui.render();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
parent.update();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,176 @@
|
|||
package projectzombie.menu;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import bdf.file.BdfFileManager;
|
||||
import bdf.types.BdfArray;
|
||||
import bdf.types.BdfNamedList;
|
||||
import bdf.types.BdfObject;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.input.types.InputGUI;
|
||||
import projectzombie.menu.gui.GUI;
|
||||
import projectzombie.menu.gui.GUIAlignment;
|
||||
import projectzombie.menu.gui.GUIBackToMenu;
|
||||
import projectzombie.menu.gui.GUIButtonBasic;
|
||||
import projectzombie.menu.gui.GUILabel;
|
||||
import projectzombie.menu.gui.GUITextBox;
|
||||
import projectzombie.world.World;
|
||||
|
||||
public class MenuWorldNew extends Menu
|
||||
{
|
||||
private static final Random rand = new Random();
|
||||
|
||||
private Menu parent;
|
||||
private String name;
|
||||
private long seed;
|
||||
|
||||
private GUI gui;
|
||||
private GUITextBox world_name;
|
||||
|
||||
public MenuWorldNew(Menu parent)
|
||||
{
|
||||
this.parent = parent;
|
||||
|
||||
name = "World";
|
||||
seed = rand.nextLong();
|
||||
keepMouse = false;
|
||||
|
||||
doGameloop = parent.doGameloop;
|
||||
doGameRender = parent.doGameRender;
|
||||
showIngameGUI = parent.showIngameGUI;
|
||||
|
||||
gui = new GUIBackToMenu(parent);
|
||||
input = new InputGUI(gui);
|
||||
|
||||
GUIButtonBasic buttonBack = new GUIButtonBasic("Back", button -> {
|
||||
Main.menu = parent;
|
||||
});
|
||||
|
||||
GUIButtonBasic buttonCreate = new GUIButtonBasic("Generate", button -> {
|
||||
generateWorld();
|
||||
});
|
||||
|
||||
buttonBack.setAlign(GUIAlignment.RIGHT);
|
||||
buttonCreate.setAlign(GUIAlignment.LEFT);
|
||||
|
||||
buttonBack.setPos(new Vec2d(-0.5, -8));
|
||||
buttonCreate.setPos(new Vec2d(0.5, -8));
|
||||
|
||||
{
|
||||
// New world title label
|
||||
GUILabel label = new GUILabel();
|
||||
label.setText("Create New World");
|
||||
label.setSize(new Vec2d(1, 1));
|
||||
label.setPos(new Vec2d(0, 6.8));
|
||||
gui.add(label);
|
||||
}
|
||||
|
||||
{
|
||||
// Set the world name
|
||||
|
||||
double offset = -Models.UI_TEXT_BOX.getWidth() / 2;
|
||||
|
||||
GUILabel label = new GUILabel();
|
||||
label.setAlign(GUIAlignment.RIGHT);
|
||||
label.setText("World Name");
|
||||
label.setSize(new Vec2d(0.4, 0.4));
|
||||
label.setPos(new Vec2d(offset + Models.UI_TEXT_BOX.getWidth() * 2 / 128.0, 4));
|
||||
gui.add(label);
|
||||
|
||||
world_name = new GUITextBox(new Vec2d(offset, 3.8 - Models.UI_TEXT_BOX.getHeight()), true);
|
||||
world_name.setText(name);
|
||||
gui.add(world_name);
|
||||
}
|
||||
|
||||
gui.add(buttonBack);
|
||||
gui.add(buttonCreate);
|
||||
}
|
||||
|
||||
private void generateWorld()
|
||||
{
|
||||
name = world_name.getText();
|
||||
|
||||
String path = name;
|
||||
path = path.toLowerCase();
|
||||
|
||||
char[] path_chars = path.toCharArray();
|
||||
|
||||
for(int i=0;i<path_chars.length;i++)
|
||||
{
|
||||
char c = path_chars[i];
|
||||
|
||||
if((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z')) {
|
||||
path_chars[i] = c;
|
||||
} else {
|
||||
path_chars[i] = '_';
|
||||
}
|
||||
}
|
||||
|
||||
path = new String(path_chars);
|
||||
|
||||
if(name.length() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
BdfFileManager reader = new BdfFileManager("./saves.bdf", true);
|
||||
BdfObject bdf = reader.getObject();
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
BdfArray array = nl.get("saves").getArray();
|
||||
|
||||
// Find a unique name and path
|
||||
|
||||
String name_new = name;
|
||||
String path_new = path;
|
||||
|
||||
boolean duplicate = true;
|
||||
|
||||
for(int i=1;duplicate;i++)
|
||||
{
|
||||
duplicate = false;
|
||||
|
||||
for(BdfObject save_bdf : array)
|
||||
{
|
||||
BdfNamedList save_nl = save_bdf.getNamedList();
|
||||
String save_name = save_nl.get("name").getString();
|
||||
String save_path = save_nl.get("path").getString();
|
||||
|
||||
if(i > 1) {
|
||||
name_new = name + " (" + i + ")";
|
||||
path_new = path + "_" + i;
|
||||
}
|
||||
|
||||
if(name_new.contentEquals(save_name) || path_new.contentEquals(save_path)) {
|
||||
duplicate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BdfObject save_bdf = bdf.newObject();
|
||||
BdfNamedList save_nl = save_bdf.getNamedList();
|
||||
|
||||
save_nl.set("name", bdf.newObject().setString(name_new));
|
||||
save_nl.set("path", bdf.newObject().setString(path_new));
|
||||
|
||||
array.add(save_bdf);
|
||||
reader.saveDatabase();
|
||||
|
||||
World.createWorld(path_new, seed);
|
||||
Main.menu = new MenuGame();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
super.update();
|
||||
parent.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
gui.render();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,18 +2,26 @@ package projectzombie.menu.gui;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import gl_engine.matrix.Matrix4;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.input.CursorPosCallback;
|
||||
import projectzombie.input.types.InputGUITextBox;
|
||||
|
||||
public class GUI implements GUIContainer
|
||||
{
|
||||
private ArrayList<GUIComponent> components = new ArrayList<GUIComponent>();
|
||||
private Vec2d mousePos = new Vec2d(0, 0);
|
||||
|
||||
public GUISelectable selected;
|
||||
private InputGUITextBox text_box;
|
||||
|
||||
private static boolean move_last = false;
|
||||
|
||||
public void setTextBox(InputGUITextBox text_box) {
|
||||
this.text_box = text_box;
|
||||
}
|
||||
|
||||
public void setSelected(GUISelectable selected) {
|
||||
if(this.selected != null) {
|
||||
this.selected.setSelected(false);
|
||||
|
|
@ -31,8 +39,12 @@ public class GUI implements GUIContainer
|
|||
}
|
||||
}
|
||||
|
||||
public Vec2d getCursorPos() {
|
||||
return CursorPosCallback.getCursorPos();
|
||||
}
|
||||
|
||||
public void render() {
|
||||
this.render(Matrix4.identity(), mousePos, true);
|
||||
this.render(Matrix4.identity(), getCursorPos(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -40,10 +52,6 @@ public class GUI implements GUIContainer
|
|||
components.add(c);
|
||||
}
|
||||
|
||||
public void updateMousePos(Vec2d pos) {
|
||||
this.mousePos = pos;
|
||||
}
|
||||
|
||||
public void onMove(boolean status, double angle)
|
||||
{
|
||||
if(this.selected == null) {
|
||||
|
|
@ -96,38 +104,59 @@ public class GUI implements GUIContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClick(Vec2d pos) {
|
||||
public void onMouseClick(Vec2d pos)
|
||||
{
|
||||
if(text_box != null && text_box instanceof GUIComponent && !((GUIComponent)text_box).checkMouseHover(pos)) {
|
||||
text_box.setFocus(false);
|
||||
text_box = null;
|
||||
}
|
||||
|
||||
Vec2d cursorPos = getCursorPos();
|
||||
|
||||
for(GUIComponent c : components) {
|
||||
if(c.checkMouseHover(mousePos)) {
|
||||
c.onMouseClick(mousePos);
|
||||
if(c.checkMouseHover(cursorPos)) {
|
||||
c.onMouseClick(cursorPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRightClick(Vec2d pos) {
|
||||
public void onRightClick(Vec2d pos)
|
||||
{
|
||||
Vec2d cursorPos = getCursorPos();
|
||||
|
||||
for(GUIComponent c : components) {
|
||||
if(c.checkMouseHover(mousePos)) {
|
||||
c.onRightClick(mousePos);
|
||||
if(c.checkMouseHover(cursorPos)) {
|
||||
c.onRightClick(cursorPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onMouseClick() {
|
||||
this.onMouseClick(mousePos);
|
||||
this.onMouseClick(getCursorPos());
|
||||
}
|
||||
|
||||
public void onRightClick() {
|
||||
this.onRightClick(mousePos);
|
||||
this.onRightClick(getCursorPos());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBack() {
|
||||
public void onBack()
|
||||
{
|
||||
if(text_box == null)
|
||||
{
|
||||
for(GUIComponent c : components) {
|
||||
c.onBack();
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
text_box.setFocus(false);
|
||||
text_box = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivate() {
|
||||
for(GUIComponent c : components) {
|
||||
|
|
@ -150,7 +179,63 @@ public class GUI implements GUIContainer
|
|||
}
|
||||
|
||||
public void onScroll(int amount) {
|
||||
onScroll(mousePos, amount / 10.0);
|
||||
onScroll(getCursorPos(), amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
components.clear();
|
||||
}
|
||||
|
||||
public void type(char character) {
|
||||
if(text_box != null) {
|
||||
text_box.onPressed(character);
|
||||
}
|
||||
}
|
||||
|
||||
public void pasteKey() {
|
||||
if(text_box != null) {
|
||||
text_box.onDelete();
|
||||
}
|
||||
}
|
||||
|
||||
public void keyPress(int key) {
|
||||
if(text_box != null)
|
||||
{
|
||||
switch(key)
|
||||
{
|
||||
case GLFW.GLFW_KEY_LEFT:
|
||||
text_box.onMoveCursor(-1);
|
||||
break;
|
||||
case GLFW.GLFW_KEY_RIGHT:
|
||||
text_box.onMoveCursor(1);
|
||||
break;
|
||||
case GLFW.GLFW_KEY_DELETE:
|
||||
text_box.onDelete();
|
||||
break;
|
||||
case GLFW.GLFW_KEY_BACKSPACE:
|
||||
text_box.onBackspace();
|
||||
break;
|
||||
case GLFW.GLFW_KEY_HOME:
|
||||
text_box.onHome();
|
||||
break;
|
||||
case GLFW.GLFW_KEY_END:
|
||||
text_box.onEnd();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void keyPressCtrl(int key) {
|
||||
if(text_box != null)
|
||||
{
|
||||
switch(key)
|
||||
{
|
||||
case GLFW.GLFW_KEY_V:
|
||||
text_box.onPaste();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,10 @@ package projectzombie.menu.gui;
|
|||
import gl_engine.matrix.Matrix4;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.input.InputMode;
|
||||
import projectzombie.model.ModelGui;
|
||||
import projectzombie.text.Text;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
|
||||
public class GUIButton implements GUIComponent, GUISelectable
|
||||
{
|
||||
|
|
|
|||
|
|
@ -105,4 +105,9 @@ public class GUIButtonGroup implements GUIContainer
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
buttons.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ public class GUIButtonGroupPause extends GUIButtonGroup
|
|||
public GUIButtonGroupPause()
|
||||
{
|
||||
add(new GUIButtonBasic("Settings", button -> {
|
||||
Main.menu.input.mousePos(new Vec2d(0, 0));
|
||||
Main.menu = new MenuSettings(Main.menu);
|
||||
}));
|
||||
|
||||
|
|
|
|||
|
|
@ -3,4 +3,5 @@ package projectzombie.menu.gui;
|
|||
public interface GUIContainer extends GUIComponent
|
||||
{
|
||||
public void add(GUIComponent c);
|
||||
public void clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,9 @@ import org.lwjgl.opengl.GL33;
|
|||
|
||||
import gl_engine.matrix.Matrix4;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec4d;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.init.Models;
|
||||
|
||||
public class GUIContainerSlider implements GUIComponent, GUIContainer
|
||||
{
|
||||
|
|
@ -39,8 +40,8 @@ public class GUIContainerSlider implements GUIComponent, GUIContainer
|
|||
canHover = false;
|
||||
}
|
||||
|
||||
matrix = Matrix4.multiply(matrix, Matrix4.translate(0, -scroll, 0));
|
||||
mousePos = mousePos.add(new Vec2d(0, scroll));
|
||||
matrix = Matrix4.multiply(matrix, Matrix4.translate(0, scroll, 0));
|
||||
mousePos = mousePos.add(new Vec2d(0, -scroll));
|
||||
|
||||
GL33.glUniform1i(Main.window.glsl_do_discard_coords, 1);
|
||||
GL33.glUniform4f(Main.window.glsl_discard_coords,
|
||||
|
|
@ -50,6 +51,26 @@ public class GUIContainerSlider implements GUIComponent, GUIContainer
|
|||
c.render(matrix, mousePos, canHover);
|
||||
}
|
||||
|
||||
if(length > 0)
|
||||
{
|
||||
GL33.glUniform4f(Main.window.glsl_color, 0.25f, 0.25f, 0.25f, 1);
|
||||
|
||||
double start = size.y * scroll / (length + size.y);
|
||||
double end = size.y * (scroll + size.y) / (length + size.y);
|
||||
|
||||
Matrix4 matrix_scroll_bar = Matrix4.translate(
|
||||
pos.x + size.x - 0.125f,
|
||||
pos.y + size.y - end, 0);
|
||||
|
||||
matrix_scroll_bar = Matrix4.multiply(Matrix4.scale(
|
||||
new Vec3d(1, (float)(end - start), 1)), matrix_scroll_bar);
|
||||
|
||||
Models.UI_PIXEL_WHITE.setModel(matrix_scroll_bar);
|
||||
Models.UI_PIXEL_WHITE.render();
|
||||
|
||||
GL33.glUniform4f(Main.window.glsl_color, 1, 1, 1, 1);
|
||||
}
|
||||
|
||||
GL33.glUniform1i(Main.window.glsl_do_discard_coords, 0);
|
||||
}
|
||||
|
||||
|
|
@ -60,7 +81,7 @@ public class GUIContainerSlider implements GUIComponent, GUIContainer
|
|||
return;
|
||||
}
|
||||
|
||||
mousePos = mousePos.add(new Vec2d(0, scroll));
|
||||
mousePos = mousePos.add(new Vec2d(0, -scroll));
|
||||
|
||||
for(GUIComponent c : components) {
|
||||
c.update(mousePos);
|
||||
|
|
@ -79,7 +100,7 @@ public class GUIContainerSlider implements GUIComponent, GUIContainer
|
|||
return;
|
||||
}
|
||||
|
||||
mousePos = mousePos.add(new Vec2d(0, scroll));
|
||||
mousePos = mousePos.add(new Vec2d(0, -scroll));
|
||||
|
||||
for(GUIComponent c : components) {
|
||||
if(c.checkMouseHover(mousePos)) {
|
||||
|
|
@ -95,7 +116,7 @@ public class GUIContainerSlider implements GUIComponent, GUIContainer
|
|||
return;
|
||||
}
|
||||
|
||||
mousePos = mousePos.add(new Vec2d(0, scroll));
|
||||
mousePos = mousePos.add(new Vec2d(0, -scroll));
|
||||
|
||||
for(GUIComponent c : components) {
|
||||
if(c.checkMouseHover(mousePos)) {
|
||||
|
|
@ -142,4 +163,9 @@ public class GUIContainerSlider implements GUIComponent, GUIContainer
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
components.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package projectzombie.menu.gui;
|
||||
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.matrix.Matrix4;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec3d;
|
||||
|
|
@ -8,7 +7,6 @@ import projectzombie.Main;
|
|||
import projectzombie.entity.EntityItem;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.text.Text;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,12 +3,10 @@ package projectzombie.menu.gui;
|
|||
import gl_engine.matrix.Matrix4;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.text.Text;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
|
||||
public class GUIItemSlot implements GUIComponent
|
||||
|
|
|
|||
|
|
@ -2,8 +2,10 @@ package projectzombie.menu.gui;
|
|||
|
||||
import gl_engine.matrix.Matrix4;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.ModelGui;
|
||||
import projectzombie.text.Text;
|
||||
|
||||
public class GUISavesCard implements GUIComponent
|
||||
{
|
||||
|
|
@ -12,12 +14,12 @@ public class GUISavesCard implements GUIComponent
|
|||
private Vec2d pos = new Vec2d(0, 0);
|
||||
private GUIButtonModel buttonDelete;
|
||||
private GUIButtonModel buttonPlay;
|
||||
private String text;
|
||||
|
||||
public GUISavesCard(Vec2d pos)
|
||||
public GUISavesCard(String text, Vec2d pos)
|
||||
{
|
||||
pos.x -= LABEL.getWidth() / 2;
|
||||
|
||||
this.pos = pos;
|
||||
this.text = text;
|
||||
|
||||
buttonDelete = new GUIButtonModel(Models.UI_BUTTON_DELETE, Models.UI_BUTTON_DELETE_HOVER, button -> {
|
||||
onDeletePressed();
|
||||
|
|
@ -27,8 +29,8 @@ public class GUISavesCard implements GUIComponent
|
|||
onPlayPressed();
|
||||
});
|
||||
|
||||
buttonPlay.setPos(new Vec2d(-LABEL.getWidth()*122/256.0, LABEL.getHeight()*6/32.0));
|
||||
buttonDelete.setPos(new Vec2d(LABEL.getWidth()*102/256.0, LABEL.getHeight()*6/32.0));
|
||||
buttonPlay.setPos(pos.add(new Vec2d(LABEL.getWidth()*10/256.0, LABEL.getHeight()*6/32.0)));
|
||||
buttonDelete.setPos(pos.add(new Vec2d(LABEL.getWidth()*226/256.0, LABEL.getHeight()*6/32.0)));
|
||||
}
|
||||
|
||||
public void onPlayPressed() {
|
||||
|
|
@ -42,9 +44,19 @@ public class GUISavesCard implements GUIComponent
|
|||
@Override
|
||||
public void render(Matrix4 matrix, Vec2d mousePos, boolean canHover)
|
||||
{
|
||||
LABEL.setModel(Matrix4.multiply(Matrix4.translate(pos.x, pos.y, 0), matrix));
|
||||
Matrix4 label_matrix = Matrix4.multiply(Matrix4.translate(pos.x, pos.y, 0), matrix);
|
||||
|
||||
LABEL.setModel(label_matrix);
|
||||
LABEL.render();
|
||||
|
||||
Matrix4 text_matrix = label_matrix;
|
||||
text_matrix = Matrix4.multiply(text_matrix, Matrix4.translate(
|
||||
LABEL.getWidth() * 38 / 256.0,
|
||||
LABEL.getHeight() / 2 - 0.25, 0));
|
||||
text_matrix = Matrix4.multiply(Matrix4.scale(new Vec3d(0.5, 0.5, 0.5)), text_matrix);
|
||||
|
||||
Text.render(text, text_matrix);
|
||||
|
||||
buttonDelete.render(matrix, mousePos, canHover);
|
||||
buttonPlay.render(matrix, mousePos, canHover);
|
||||
}
|
||||
|
|
@ -57,8 +69,7 @@ public class GUISavesCard implements GUIComponent
|
|||
|
||||
@Override
|
||||
public boolean checkMouseHover(Vec2d pos) {
|
||||
return (this.pos.x > pos.x && this.pos.x + LABEL.getWidth() < pos.x &&
|
||||
this.pos.y > pos.y && this.pos.y + LABEL.getHeight() < pos.y);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -0,0 +1,243 @@
|
|||
package projectzombie.menu.gui;
|
||||
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
import java.awt.datatransfer.UnsupportedFlavorException;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.lwjgl.opengl.GL33;
|
||||
|
||||
import gl_engine.matrix.Matrix4;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.input.types.InputGUI;
|
||||
import projectzombie.input.types.InputGUITextBox;
|
||||
import projectzombie.model.ModelGui;
|
||||
import projectzombie.text.Text;
|
||||
|
||||
public class GUITextBox implements GUIComponent, InputGUITextBox
|
||||
{
|
||||
private static final ModelGui BOX = Models.UI_TEXT_BOX;
|
||||
private static final ModelGui CURSOR = Models.UI_TEXT_CURSOR;
|
||||
|
||||
private Vec2d pos;
|
||||
private String text = "";
|
||||
private int cursor_pos = 0;
|
||||
private boolean in_focus = false;
|
||||
private double offset = 0;
|
||||
private int max;
|
||||
|
||||
public GUITextBox(Vec2d pos, int max) {
|
||||
this.pos = pos;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public GUITextBox(Vec2d pos, boolean max) {
|
||||
this(pos, max ? 22 : -1);
|
||||
}
|
||||
|
||||
public GUITextBox(Vec2d pos) {
|
||||
this(pos, -1);
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Matrix4 matrix, Vec2d mousePos, boolean canHover)
|
||||
{
|
||||
Matrix4 box_matrix = Matrix4.multiply(matrix, Matrix4.translate(pos.x, pos.y, 0));
|
||||
|
||||
BOX.setModel(box_matrix);
|
||||
BOX.render();
|
||||
|
||||
// Set text to black and make sure text gets clipped outside the text box
|
||||
GL33.glUniform4f(Main.window.glsl_color, 0.1f, 0.1f, 0.1f, 1);
|
||||
GL33.glUniform4f(Main.window.glsl_discard_coords,
|
||||
(float)(pos.x + BOX.getWidth() * 2 / 128.0),
|
||||
(float)(pos.y + BOX.getHeight() * 2 / 16.0),
|
||||
(float)(pos.x + BOX.getWidth() * 126 / 128.0),
|
||||
(float)(pos.y + BOX.getHeight() * 14 / 16.0));
|
||||
GL33.glUniform1i(Main.window.glsl_do_discard_coords, 1);
|
||||
|
||||
Matrix4 text_matrix = box_matrix;
|
||||
text_matrix = Matrix4.multiply(text_matrix, Matrix4.translate((1 - offset) * 0.5, 0.5, 0));
|
||||
text_matrix = Matrix4.multiply(Matrix4.scale(new Vec3d(0.5, 0.5, 0.5)), text_matrix);
|
||||
|
||||
Text.render(text, text_matrix);
|
||||
|
||||
if(in_focus) {
|
||||
CURSOR.setModel(Matrix4.multiply(text_matrix, Matrix4.translate(cursor_pos * 0.5, 0, 0)));
|
||||
CURSOR.render();
|
||||
}
|
||||
|
||||
// Reset the settings back to default
|
||||
GL33.glUniform4f(Main.window.glsl_color, 1, 1, 1, 1);
|
||||
GL33.glUniform1i(Main.window.glsl_do_discard_coords, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Vec2d mousePos) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkMouseHover(Vec2d mousePos) {
|
||||
return (mousePos.x > this.pos.x && mousePos.x < this.pos.x + BOX.getWidth() &&
|
||||
mousePos.y > this.pos.y && mousePos.y < this.pos.y + BOX.getHeight());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClick(Vec2d mousePos)
|
||||
{
|
||||
((InputGUI)Main.menu.input).getGUI().setTextBox(this);
|
||||
in_focus = true;
|
||||
|
||||
cursor_pos = (int)((mousePos.x - pos.x + offset * 0.5 - 0.5) * 2 + 0.5);
|
||||
|
||||
if(cursor_pos > text.length()) {
|
||||
cursor_pos = text.length();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateText()
|
||||
{
|
||||
// Update the text fields offset to
|
||||
// keep the cursor in the text field
|
||||
double o = BOX.getWidth() - 1;
|
||||
|
||||
if(cursor_pos - o < offset) {
|
||||
offset = cursor_pos - o;
|
||||
}
|
||||
|
||||
if(cursor_pos - o * 2 > offset) {
|
||||
offset = cursor_pos - o * 2;
|
||||
}
|
||||
|
||||
if(offset < 0) {
|
||||
offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPaste()
|
||||
{
|
||||
try
|
||||
{
|
||||
String clipboard = (String)(Main.clipboard.getData(DataFlavor.stringFlavor));
|
||||
|
||||
if(max == -1 || text.length() + clipboard.length() <= max)
|
||||
{
|
||||
text = text.substring(0, cursor_pos) + clipboard + text.substring(cursor_pos, text.length());
|
||||
cursor_pos += clipboard.length();
|
||||
|
||||
updateText();
|
||||
}
|
||||
|
||||
else if(text.length() < max)
|
||||
{
|
||||
clipboard = clipboard.substring(0, max - text.length());
|
||||
|
||||
text = text.substring(0, cursor_pos) + clipboard + text.substring(cursor_pos, text.length());
|
||||
cursor_pos += clipboard.length();
|
||||
|
||||
updateText();
|
||||
}
|
||||
}
|
||||
|
||||
catch (UnsupportedFlavorException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackspace()
|
||||
{
|
||||
if(cursor_pos == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
text = text.substring(0, cursor_pos - 1) + text.substring(cursor_pos, text.length());
|
||||
cursor_pos -= 1;
|
||||
|
||||
updateText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDelete()
|
||||
{
|
||||
if(cursor_pos == text.length()) {
|
||||
return;
|
||||
}
|
||||
|
||||
text = text.substring(0, cursor_pos) + text.substring(cursor_pos + 1, text.length());
|
||||
|
||||
updateText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMoveCursor(int direction)
|
||||
{
|
||||
cursor_pos += direction;
|
||||
|
||||
if(cursor_pos < 0) {
|
||||
cursor_pos = 0;
|
||||
}
|
||||
|
||||
if(cursor_pos > text.length()) {
|
||||
cursor_pos = text.length();
|
||||
}
|
||||
|
||||
updateText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHome() {
|
||||
cursor_pos = 0;
|
||||
updateText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnd() {
|
||||
cursor_pos = text.length();
|
||||
updateText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPressed(char character)
|
||||
{
|
||||
if(max == -1 || text.length() < max)
|
||||
{
|
||||
text = text.substring(0, cursor_pos) + character + text.substring(cursor_pos, text.length());
|
||||
cursor_pos += 1;
|
||||
|
||||
updateText();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFocus(boolean focus) {
|
||||
in_focus = focus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScroll(Vec2d mousePos, double amount) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRightClick(Vec2d mousePos) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivate() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBack() {
|
||||
}
|
||||
}
|
||||
|
|
@ -19,14 +19,13 @@ import gl_engine.MathHelpers;
|
|||
import gl_engine.matrix.Matrix4;
|
||||
import gl_engine.texture.TextureRef3D;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.init.Resources;
|
||||
|
||||
public abstract class Model implements IModel
|
||||
{
|
||||
private static final Random rand = new Random();
|
||||
|
||||
public static final float OFFSET = 0.001f;
|
||||
public static final float OFFSET = 0.00001f;
|
||||
public static final int SIZE = 16;
|
||||
public static IModel bound = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package projectzombie.model;
|
||||
|
||||
import gl_engine.texture.TextureRef3D;
|
||||
import projectzombie.init.Resources;
|
||||
|
||||
public class ModelGrass extends ModelTile
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package projectzombie.model;
|
||||
|
||||
import gl_engine.texture.TextureRef3D;
|
||||
import gl_engine.vec.Vec2d;
|
||||
|
||||
public class ModelRock extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package projectzombie.model;
|
||||
|
||||
import gl_engine.texture.TextureRef3D;
|
||||
import projectzombie.init.Resources;
|
||||
|
||||
public class ModelTallGrass extends ModelCross
|
||||
|
|
|
|||
|
|
@ -1,21 +1,18 @@
|
|||
package projectzombie.settings;
|
||||
|
||||
import bdf.classes.BdfClassManager;
|
||||
import bdf.classes.IBdfClassManager;
|
||||
import bdf.file.BdfFileManager;
|
||||
import bdf.types.BdfNamedList;
|
||||
import bdf.types.BdfObject;
|
||||
import bdf.types.BdfTypes;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.display.DisplayRender;
|
||||
import projectzombie.display.DisplayRenderUI;
|
||||
import projectzombie.display.DisplayWindow;
|
||||
import projectzombie.entity.EntityParticle;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
|
||||
public class Settings implements IBdfClassManager
|
||||
{
|
||||
public static final BdfClassManager SETTINGS = new BdfClassManager(new Settings());
|
||||
public static final Settings SETTINGS = new Settings();
|
||||
private static BdfFileManager FILE_MANAGER;
|
||||
|
||||
@Override
|
||||
|
|
@ -114,21 +111,21 @@ public class Settings implements IBdfClassManager
|
|||
}
|
||||
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
nl.set("render_distance", BdfObject.withInteger(Chunk.RENDER_DISTANCE));
|
||||
nl.set("show_fps", BdfObject.withBoolean(DisplayRenderUI.showFPS));
|
||||
nl.set("debug", BdfObject.withBoolean(DisplayRenderUI.debug));
|
||||
nl.set("shadow_size", BdfObject.withInteger(shadow_size));
|
||||
nl.set("fullscreen", BdfObject.withBoolean(DisplayWindow.fullscreen));
|
||||
nl.set("vsync", BdfObject.withBoolean(DisplayWindow.vsync));
|
||||
nl.set("render_distance", bdf.newObject().setInteger(Chunk.RENDER_DISTANCE));
|
||||
nl.set("show_fps", bdf.newObject().setBoolean(DisplayRenderUI.showFPS));
|
||||
nl.set("debug", bdf.newObject().setBoolean(DisplayRenderUI.debug));
|
||||
nl.set("shadow_size", bdf.newObject().setInteger(shadow_size));
|
||||
nl.set("fullscreen", bdf.newObject().setBoolean(DisplayWindow.fullscreen));
|
||||
nl.set("vsync", bdf.newObject().setBoolean(DisplayWindow.vsync));
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
FILE_MANAGER = new BdfFileManager(Environment.gdir + "/settings.bdf", true);
|
||||
SETTINGS.load(FILE_MANAGER);
|
||||
SETTINGS.BdfClassLoad(FILE_MANAGER.getObject());
|
||||
}
|
||||
|
||||
public static void update() {
|
||||
SETTINGS.save(FILE_MANAGER);
|
||||
SETTINGS.BdfClassSave(FILE_MANAGER.getObject());
|
||||
FILE_MANAGER.saveDatabase();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,14 +2,12 @@ package projectzombie.task;
|
|||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import bdf.classes.IBdfClassManager;
|
||||
import bdf.types.BdfArray;
|
||||
import bdf.types.BdfNamedList;
|
||||
import bdf.types.BdfObject;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.init.Entities;
|
||||
import projectzombie.init.Tasks;
|
||||
|
||||
public abstract class Task implements IBdfClassManager
|
||||
|
|
@ -50,7 +48,7 @@ public abstract class Task implements IBdfClassManager
|
|||
|
||||
// Send back null if the id is out of range
|
||||
if(id < 0 || id >= Tasks.TASKS.size()) {
|
||||
System.out.println("Warning: Invalid ID detected: " + id);
|
||||
System.out.println("Invalid task ID found: " + id);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +83,7 @@ public abstract class Task implements IBdfClassManager
|
|||
@Override
|
||||
public void BdfClassSave(BdfObject bdf) {
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
nl.set("id", BdfObject.withInteger(getID()));
|
||||
nl.set("id", bdf.newObject().setInteger(getID()));
|
||||
}
|
||||
|
||||
public static Task[] loadTasks(Entity parent, BdfObject bdf)
|
||||
|
|
@ -100,16 +98,17 @@ public abstract class Task implements IBdfClassManager
|
|||
return tasks;
|
||||
}
|
||||
|
||||
public static BdfObject saveTasks(Task[] tasks)
|
||||
public static BdfObject saveTasks(BdfObject bdf, Task[] tasks)
|
||||
{
|
||||
BdfArray array = new BdfArray();
|
||||
BdfArray array = bdf.getArray();
|
||||
bdf.setArray(array);
|
||||
|
||||
for(int i=0;i<tasks.length;i++) {
|
||||
BdfObject task_bdf = new BdfObject();
|
||||
BdfObject task_bdf = bdf.newObject();
|
||||
tasks[i].BdfClassSave(task_bdf);
|
||||
array.add(task_bdf);
|
||||
}
|
||||
|
||||
return BdfObject.withArray(array);
|
||||
return bdf;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class TaskDeathScreen extends Task
|
|||
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
|
||||
nl.set("timer", BdfObject.withInteger(timer));
|
||||
nl.set("timer", bdf.newObject().setInteger(timer));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ public class TaskLadderDown extends Task
|
|||
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
|
||||
nl.set("layerID", BdfObject.withInteger(layerID));
|
||||
nl.set("step", BdfObject.withInteger(step));
|
||||
nl.set("layerID", bdf.newObject().setInteger(layerID));
|
||||
nl.set("step", bdf.newObject().setInteger(step));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -2,14 +2,11 @@ package projectzombie.task;
|
|||
|
||||
import bdf.types.BdfNamedList;
|
||||
import bdf.types.BdfObject;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.util.math.TileState;
|
||||
import projectzombie.world.chunk.ChunkEventHandler;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class TaskLadderUp extends Task
|
||||
{
|
||||
|
|
@ -43,8 +40,8 @@ public class TaskLadderUp extends Task
|
|||
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
|
||||
nl.set("layerID", BdfObject.withInteger(layerID));
|
||||
nl.set("step", BdfObject.withInteger(step));
|
||||
nl.set("layerID", bdf.newObject().setInteger(layerID));
|
||||
nl.set("step", bdf.newObject().setInteger(step));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -89,6 +89,19 @@ public class Text
|
|||
public static final Model CHAR_HASHTAG = new ModelGui(Resources.ATLAS.get("/text/char_hashtag.png"));
|
||||
public static final Model CHAR_L_THAN = new ModelGui(Resources.ATLAS.get("/text/char_lthan.png"));
|
||||
public static final Model CHAR_G_THAN = new ModelGui(Resources.ATLAS.get("/text/char_gthan.png"));
|
||||
public static final Model CHAR_APOSTROPHE = new ModelGui(Resources.ATLAS.get("/text/char_apostrophe.png"));
|
||||
public static final Model CHAR_GRAVE = new ModelGui(Resources.ATLAS.get("/text/char_grave.png"));
|
||||
public static final Model CHAR_QUOTATION = new ModelGui(Resources.ATLAS.get("/text/char_quotation.png"));
|
||||
public static final Model CHAR_SEMICOLON = new ModelGui(Resources.ATLAS.get("/text/char_semicolon.png"));
|
||||
public static final Model CHAR_TILDE = new ModelGui(Resources.ATLAS.get("/text/char_tilde.png"));
|
||||
public static final Model CHAR_BRACKET_OC = new ModelGui(Resources.ATLAS.get("/text/char_ocbracket.png"));
|
||||
public static final Model CHAR_BRACKET_CC = new ModelGui(Resources.ATLAS.get("/text/char_ccbracket.png"));
|
||||
public static final Model CHAR_BRACKET_OS = new ModelGui(Resources.ATLAS.get("/text/char_osbracket.png"));
|
||||
public static final Model CHAR_BRACKET_CS = new ModelGui(Resources.ATLAS.get("/text/char_csbracket.png"));
|
||||
public static final Model CHAR_STAR = new ModelGui(Resources.ATLAS.get("/text/char_star.png"));
|
||||
public static final Model CHAR_AND = new ModelGui(Resources.ATLAS.get("/text/char_and.png"));
|
||||
public static final Model CHAR_AT = new ModelGui(Resources.ATLAS.get("/text/char_at.png"));
|
||||
public static final Model CHAR_POW = new ModelGui(Resources.ATLAS.get("/text/char_pow.png"));
|
||||
|
||||
public static void render(String text, Matrix4 matrix)
|
||||
{
|
||||
|
|
@ -183,6 +196,19 @@ public class Text
|
|||
case('#'): l = CHAR_HASHTAG; break;
|
||||
case('>'): l = CHAR_G_THAN; break;
|
||||
case('<'): l = CHAR_L_THAN; break;
|
||||
case('`'): l = CHAR_GRAVE; break;
|
||||
case('~'): l = CHAR_TILDE; break;
|
||||
case('\''): l = CHAR_APOSTROPHE; break;
|
||||
case('"'): l = CHAR_QUOTATION; break;
|
||||
case(';'): l = CHAR_SEMICOLON; break;
|
||||
case('@'): l = CHAR_AT; break;
|
||||
case('&'): l = CHAR_AND; break;
|
||||
case('*'): l = CHAR_STAR; break;
|
||||
case('^'): l = CHAR_POW; break;
|
||||
case('['): l = CHAR_BRACKET_OS; break;
|
||||
case(']'): l = CHAR_BRACKET_CS; break;
|
||||
case('{'): l = CHAR_BRACKET_OC; break;
|
||||
case('}'): l = CHAR_BRACKET_CC; break;
|
||||
}
|
||||
|
||||
if(l != null)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package projectzombie.tiles;
|
||||
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.init.Tiles;
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
package projectzombie.tiles;
|
||||
|
||||
import gl_engine.vec.Vec2i;
|
||||
import mainloop.task.IMainloopTask;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.mainloop.MainloopEventHandler;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.task.TaskLadderUp;
|
||||
import projectzombie.util.math.TileState;
|
||||
import projectzombie.world.chunk.ChunkEventHandler;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class TileLadderUp extends Tile
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
package projectzombie.tiles;
|
||||
|
||||
import gl_engine.vec.Vec2i;
|
||||
import mainloop.task.IMainloopTask;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.mainloop.MainloopEventHandler;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.task.TaskLadderDown;
|
||||
import projectzombie.util.math.TileState;
|
||||
import projectzombie.world.chunk.ChunkEventHandler;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class TilePortalDown extends Tile
|
||||
|
|
|
|||
|
|
@ -1,16 +1,11 @@
|
|||
package projectzombie.tiles;
|
||||
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.entity.EntityItem;
|
||||
import projectzombie.init.Items;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.items.ItemTool;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import projectzombie.util.math.TileState;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class TileRock extends Tile implements TileBulletBreakable
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
package projectzombie.tiles;
|
||||
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.init.Items;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.items.ItemTool;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import projectzombie.util.math.TileState;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class TileTree extends Tile implements TileBulletBreakable
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package projectzombie.tiles;
|
||||
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.entity.particle.ParticleWater;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
|
|
|
|||
|
|
@ -46,9 +46,9 @@ public class ItemStack implements IBdfClassManager
|
|||
@Override
|
||||
public void BdfClassSave(BdfObject bdf) {
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
nl.set("meta", BdfObject.withShort(meta));
|
||||
nl.set("count", BdfObject.withInteger(count));
|
||||
nl.set("item", BdfObject.withInteger(item.id));
|
||||
nl.set("meta", bdf.newObject().setShort(meta));
|
||||
nl.set("count", bdf.newObject().setInteger(count));
|
||||
nl.set("item", bdf.newObject().setInteger(item.id));
|
||||
}
|
||||
|
||||
public ItemStack(BdfObject bdf) {
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@ import java.io.OutputStream;
|
|||
import java.lang.ProcessBuilder.Redirect;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import bdf.data.BdfDatabase;
|
||||
import bdf.data.IBdfDatabase;
|
||||
import bdf.types.BdfNamedList;
|
||||
import bdf.types.BdfObject;
|
||||
import bdf.types.BdfReader;
|
||||
import projectzombie.display.DisplayLighting;
|
||||
|
||||
public class Worker extends Thread
|
||||
|
|
@ -24,9 +25,9 @@ public class Worker extends Thread
|
|||
public Worker() throws IOException
|
||||
{
|
||||
pb = new ProcessBuilder("java", "-jar", "worker.jar");
|
||||
pb.redirectError(Redirect.INHERIT);
|
||||
pb.redirectOutput(Redirect.PIPE);
|
||||
pb.redirectInput(Redirect.PIPE);
|
||||
pb.redirectError(Redirect.INHERIT);
|
||||
|
||||
process = pb.start();
|
||||
|
||||
|
|
@ -38,39 +39,41 @@ public class Worker extends Thread
|
|||
|
||||
public void processLighting(float[] lights, int width, int height, int x, int y)
|
||||
{
|
||||
BdfObject bdf = new BdfObject();
|
||||
BdfReader reader = new BdfReader();
|
||||
BdfObject bdf = reader.getObject();
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
nl.set("task", BdfObject.withString("light"));
|
||||
nl.set("light", BdfObject.withFloatArray(lights));
|
||||
nl.set("w", BdfObject.withInteger(width));
|
||||
nl.set("h", BdfObject.withInteger(height));
|
||||
nl.set("x", BdfObject.withInteger(x));
|
||||
nl.set("y", BdfObject.withInteger(y));
|
||||
nl.set("task", bdf.newObject().setString("light"));
|
||||
nl.set("light", bdf.newObject().setFloatArray(lights));
|
||||
nl.set("w", bdf.newObject().setInteger(width));
|
||||
nl.set("h", bdf.newObject().setInteger(height));
|
||||
nl.set("x", bdf.newObject().setInteger(x));
|
||||
nl.set("y", bdf.newObject().setInteger(y));
|
||||
|
||||
sendData(bdf);
|
||||
sendData(reader);
|
||||
}
|
||||
|
||||
public void updateTime()
|
||||
{
|
||||
BdfObject bdf = new BdfObject();
|
||||
BdfReader reader = new BdfReader();
|
||||
BdfObject bdf = reader.getObject();
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
nl.set("task", BdfObject.withString("time"));
|
||||
nl.set("millis", BdfObject.withLong(System.currentTimeMillis()));
|
||||
nl.set("task", bdf.newObject().setString("time"));
|
||||
nl.set("millis", bdf.newObject().setLong(System.currentTimeMillis()));
|
||||
|
||||
sendData(bdf);
|
||||
sendData(reader);
|
||||
}
|
||||
|
||||
private void sendData(BdfObject bdf)
|
||||
private void sendData(BdfReader reader)
|
||||
{
|
||||
byte[] data = bdf.serialize().getBytes();
|
||||
IBdfDatabase data = reader.serialize();
|
||||
|
||||
ByteBuffer size_buff = ByteBuffer.allocate(4);
|
||||
size_buff.putInt(0, data.length);
|
||||
size_buff.putInt(0, data.size());
|
||||
|
||||
try
|
||||
{
|
||||
out.write(size_buff.array());
|
||||
out.write(data);
|
||||
data.writeToStream(out);
|
||||
out.write('\n');
|
||||
out.flush();
|
||||
}
|
||||
|
|
@ -97,7 +100,8 @@ public class Worker extends Thread
|
|||
in.read(data);
|
||||
in.read(new byte[1]);
|
||||
|
||||
BdfObject bdf = new BdfObject(new BdfDatabase(data));
|
||||
BdfReader reader = new BdfReader(data);
|
||||
BdfObject bdf = reader.getObject();
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
|
||||
switch(nl.get("task").getString())
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
package projectzombie.world;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL33;
|
||||
|
||||
import bdf.classes.IBdfClassManager;
|
||||
import bdf.file.BdfFileManager;
|
||||
import bdf.types.BdfArray;
|
||||
import bdf.types.BdfNamedList;
|
||||
import bdf.types.BdfObject;
|
||||
|
|
@ -16,7 +18,10 @@ import gl_engine.vec.Vec3d;
|
|||
import projectzombie.Main;
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.display.DisplayLighting;
|
||||
import projectzombie.display.bossbar.BossBars;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.init.LayerGenerators;
|
||||
import projectzombie.init.Layers;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.time.GameTimer;
|
||||
import projectzombie.world.chunk.ChunkEventHandler;
|
||||
|
|
@ -28,6 +33,7 @@ public class World implements IBdfClassManager
|
|||
|
||||
private Layer loaded;
|
||||
private ArrayList<Layer> layers = new ArrayList<Layer>();
|
||||
private BdfFileManager file_manager;
|
||||
|
||||
private String path;
|
||||
private int pool_vao, pool_vbo, pool_ibo;
|
||||
|
|
@ -37,6 +43,48 @@ public class World implements IBdfClassManager
|
|||
|
||||
public World(String path) {
|
||||
this.path = path;
|
||||
|
||||
if(path != null)
|
||||
{
|
||||
path = "./saves/" + path + ".bdf";
|
||||
File save_file = new File(path);
|
||||
File save_dir = save_file.getParentFile();
|
||||
|
||||
if(!save_dir.exists()) {
|
||||
save_dir.mkdirs();
|
||||
}
|
||||
|
||||
if(save_file.exists()) {
|
||||
file_manager = new BdfFileManager(path);
|
||||
BdfClassLoad(file_manager.getObject());
|
||||
}
|
||||
|
||||
else {
|
||||
file_manager = new BdfFileManager(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void createWorld(String path, long seed)
|
||||
{
|
||||
// Create all the layers
|
||||
Layers.EARTH = new Layer(new Random(seed), LayerGenerators.EARTH);
|
||||
Layers.CAVES = new Layer(new Random(seed), LayerGenerators.CAVES);
|
||||
Layers.LAVA_CAVES = new Layer(new Random(seed), LayerGenerators.LAVA_CAVES);
|
||||
|
||||
// Create the world and set the earth as the default layer
|
||||
Main.world = new World(path);
|
||||
Main.world.addLayer(Layers.EARTH);
|
||||
Main.world.addLayer(Layers.CAVES);
|
||||
Main.world.addLayer(Layers.LAVA_CAVES);
|
||||
Main.world.setLayer(0);
|
||||
|
||||
// Initialize some other objects
|
||||
Main.player = new EntityPlayer();
|
||||
GameTimer.resetTime();
|
||||
BossBars.clear();
|
||||
|
||||
Main.world.save();
|
||||
}
|
||||
|
||||
public String getSavePath() {
|
||||
|
|
@ -182,6 +230,24 @@ public class World implements IBdfClassManager
|
|||
return loaded;
|
||||
}
|
||||
|
||||
public void save()
|
||||
{
|
||||
if(file_manager != null)
|
||||
{
|
||||
BdfObject bdf = file_manager.resetObject();
|
||||
BdfClassSave(bdf);
|
||||
|
||||
file_manager.saveDatabase();
|
||||
}
|
||||
}
|
||||
|
||||
public void free()
|
||||
{
|
||||
for(Layer layer : layers) {
|
||||
layer.free();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void BdfClassLoad(BdfObject bdf)
|
||||
{
|
||||
|
|
@ -219,32 +285,25 @@ public class World implements IBdfClassManager
|
|||
}
|
||||
|
||||
// Save layer data
|
||||
BdfArray layers_bdf = new BdfArray();
|
||||
nl.set("loaded", BdfObject.withInteger(loaded_id));
|
||||
nl.set("layers", BdfObject.withArray(layers_bdf));
|
||||
BdfArray layers_bdf = bdf.newArray();
|
||||
nl.set("loaded", bdf.newObject().setInteger(loaded_id));
|
||||
nl.set("layers", bdf.newObject().setArray(layers_bdf));
|
||||
|
||||
for(Layer l : layers) {
|
||||
BdfObject o = new BdfObject();
|
||||
BdfObject o = bdf.newObject();
|
||||
l.BdfClassSave(o);
|
||||
layers_bdf.add(o);
|
||||
}
|
||||
|
||||
// Save player data
|
||||
BdfArray players = new BdfArray();
|
||||
nl.set("players", BdfObject.withArray(players));
|
||||
BdfArray players = bdf.newArray();
|
||||
nl.set("players", bdf.newObject().setArray(players));
|
||||
|
||||
BdfObject player = new BdfObject();
|
||||
BdfObject player = bdf.newObject();
|
||||
Main.player.BdfClassSave(player);
|
||||
players.add(player);
|
||||
|
||||
// Save the game timer
|
||||
nl.set("time", BdfObject.withLong(GameTimer.getTime()));
|
||||
}
|
||||
|
||||
public void free()
|
||||
{
|
||||
for(Layer layer : layers) {
|
||||
layer.free();
|
||||
}
|
||||
nl.set("time", bdf.newObject().setLong(GameTimer.getTime()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,8 +49,7 @@ public class Chunk implements IBdfClassManager
|
|||
private Tile tiles_front[] = new Tile[CHUNK_INDEX];
|
||||
private byte tiles_front_meta[] = new byte[CHUNK_INDEX];
|
||||
private byte tiles_back_meta[] = new byte[CHUNK_INDEX];
|
||||
private byte tiles_lighting_src[] = new byte[CHUNK_INDEX];
|
||||
private byte tiles_lighting_day[] = new byte[CHUNK_INDEX];
|
||||
private byte tiles_lighting[] = new byte[CHUNK_INDEX];
|
||||
public ArrayList<Entity> entities = new ArrayList<Entity>();
|
||||
private Layer layer;
|
||||
public Vec2i c_pos;
|
||||
|
|
@ -93,10 +92,10 @@ public class Chunk implements IBdfClassManager
|
|||
BdfNamedList nl = bdf.getNamedList();
|
||||
|
||||
// Load all the tiles and meta
|
||||
short[] tb = nl.get("tb").getShortArray();
|
||||
short[] tf = nl.get("tf").getShortArray();
|
||||
byte[] mb = nl.get("mb").getByteArray();
|
||||
byte[] mf = nl.get("mf").getByteArray();
|
||||
short[] tb = nl.get("tilesBack").getShortArray();
|
||||
short[] tf = nl.get("tilesFront").getShortArray();
|
||||
byte[] mb = nl.get("metaBack").getByteArray();
|
||||
byte[] mf = nl.get("metaFront").getByteArray();
|
||||
|
||||
for(int i=0;i<CHUNK_INDEX;i++)
|
||||
{
|
||||
|
|
@ -104,8 +103,7 @@ public class Chunk implements IBdfClassManager
|
|||
tiles_front[i] = Tiles.tiles.get(tf[i]);
|
||||
tiles_back_meta[i] = mb[i];
|
||||
tiles_front_meta[i] = mf[i];
|
||||
tiles_lighting_src[i] = 0;
|
||||
tiles_lighting_day[i] = 0;
|
||||
tiles_lighting[i] = 0;
|
||||
}
|
||||
|
||||
// Load all the entities
|
||||
|
|
@ -135,18 +133,18 @@ public class Chunk implements IBdfClassManager
|
|||
tf[i] = tiles_front[i].id;
|
||||
}
|
||||
|
||||
nl.set("tb", BdfObject.withShortArray(tb));
|
||||
nl.set("tf", BdfObject.withShortArray(tf));
|
||||
nl.set("mb", BdfObject.withByteArray(tiles_back_meta));
|
||||
nl.set("mf", BdfObject.withByteArray(tiles_front_meta));
|
||||
nl.set("tilesBack", bdf.newObject().setShortArray(tb));
|
||||
nl.set("tilesFront", bdf.newObject().setShortArray(tf));
|
||||
nl.set("metaBack", bdf.newObject().setByteArray(tiles_back_meta));
|
||||
nl.set("metaFront", bdf.newObject().setByteArray(tiles_front_meta));
|
||||
|
||||
// Save all the saveable entity data
|
||||
BdfArray bdf_entities = new BdfArray();
|
||||
nl.set("entities", BdfObject.withArray(bdf_entities));
|
||||
BdfArray bdf_entities = bdf.newArray();
|
||||
nl.set("entities", bdf.newObject().setArray(bdf_entities));
|
||||
for(Entity e : entities) {
|
||||
if(e.getID() == -1)
|
||||
continue;
|
||||
BdfObject bdf_e = new BdfObject();
|
||||
BdfObject bdf_e = bdf.newObject();
|
||||
e.BdfClassSave(bdf_e);
|
||||
bdf_entities.add(bdf_e);
|
||||
}
|
||||
|
|
@ -179,8 +177,7 @@ public class Chunk implements IBdfClassManager
|
|||
tiles_front_meta[i] = 0;
|
||||
|
||||
// Set the light level to 0
|
||||
tiles_lighting_src[i] = 0;
|
||||
tiles_lighting_day[i] = 0;
|
||||
tiles_lighting[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -531,7 +528,7 @@ public class Chunk implements IBdfClassManager
|
|||
{
|
||||
// Send back the back tile
|
||||
TileState ts = new TileState(this.tiles_back[id], this.tiles_back_meta[id]);
|
||||
ts.light = MathHelpers.biggest(getLightLevel(id), getDaylightLevel(id));
|
||||
ts.light = getLightLevel(id);
|
||||
return ts;
|
||||
}
|
||||
|
||||
|
|
@ -550,7 +547,7 @@ public class Chunk implements IBdfClassManager
|
|||
{
|
||||
// Send back the front tile
|
||||
TileState ts = new TileState(this.tiles_front[id], this.tiles_front_meta[id]);
|
||||
ts.light = MathHelpers.biggest(getLightLevel(id), getDaylightLevel(id));
|
||||
ts.light = getLightLevel(id);
|
||||
return ts;
|
||||
}
|
||||
|
||||
|
|
@ -577,7 +574,7 @@ public class Chunk implements IBdfClassManager
|
|||
}
|
||||
|
||||
public double getLightLevel(int id) {
|
||||
return tiles_lighting_src[id] / (double)Byte.MAX_VALUE;
|
||||
return tiles_lighting[id] / (double)Byte.MAX_VALUE;
|
||||
}
|
||||
|
||||
public double getLightLevel(Vec2i pos)
|
||||
|
|
@ -591,23 +588,8 @@ public class Chunk implements IBdfClassManager
|
|||
return getLightLevel(id);
|
||||
}
|
||||
|
||||
public double getDaylightLevel(int id) {
|
||||
return tiles_lighting_day[id] / (double)Byte.MAX_VALUE;
|
||||
}
|
||||
|
||||
public double getDaylightLevel(Vec2i pos)
|
||||
{
|
||||
// Get the id
|
||||
Vec2i cpos = new Vec2i(0, 0);
|
||||
cpos.x = MathHelpers.mod(pos.x, CHUNK_SIZE.mx);
|
||||
cpos.y = MathHelpers.mod(pos.y, CHUNK_SIZE.my);
|
||||
int id = cpos.getId(CHUNK_SIZE);
|
||||
|
||||
return getDaylightLevel(id);
|
||||
}
|
||||
|
||||
public void setLightLevel(double light, int id) {
|
||||
this.tiles_lighting_src[id] = (byte)(light * Byte.MAX_VALUE);
|
||||
this.tiles_lighting[id] = (byte)(light * Byte.MAX_VALUE);
|
||||
}
|
||||
|
||||
public void setLightLevel(double light, Vec2i pos)
|
||||
|
|
@ -621,21 +603,6 @@ public class Chunk implements IBdfClassManager
|
|||
setLightLevel(light, id);
|
||||
}
|
||||
|
||||
public void setDaylightLevel(double light, int id) {
|
||||
this.tiles_lighting_day[id] = (byte)(light * Byte.MAX_VALUE);
|
||||
}
|
||||
|
||||
public void setDaylightLevel(double light, Vec2i pos)
|
||||
{
|
||||
// Get the id
|
||||
Vec2i cpos = new Vec2i(0, 0);
|
||||
cpos.x = MathHelpers.mod(pos.x, CHUNK_SIZE.mx);
|
||||
cpos.y = MathHelpers.mod(pos.y, CHUNK_SIZE.my);
|
||||
int id = cpos.getId(CHUNK_SIZE);
|
||||
|
||||
setDaylightLevel(light, id);
|
||||
}
|
||||
|
||||
public void killEntity(Entity e)
|
||||
{
|
||||
if(e instanceof EntityKillWithParticles) {
|
||||
|
|
|
|||
|
|
@ -130,25 +130,6 @@ public class ChunkEmpty extends Chunk
|
|||
@Override
|
||||
public void tickRandomly() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDaylightLevel(int id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDaylightLevel(Vec2i pos) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDaylightLevel(double light, int id) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDaylightLevel(double light, Vec2i pos) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearDirty() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import bdf.types.BdfObject;
|
|||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.entity.Entity;
|
||||
|
|
@ -193,24 +192,6 @@ public class Layer implements IBdfClassManager
|
|||
chunks.get(c_pos).setLightLevel(light, pos);
|
||||
}
|
||||
|
||||
public double getDaylightLevel(Vec2i pos)
|
||||
{
|
||||
// Get the chunk pos
|
||||
Vec2i c_pos = getChunkPosFromPos(pos);
|
||||
|
||||
// Get the chunks front tile
|
||||
return chunks.get(c_pos).getDaylightLevel(pos);
|
||||
}
|
||||
|
||||
public void setDaylightLevel(double light, Vec2i pos)
|
||||
{
|
||||
// Get the chunk pos
|
||||
Vec2i c_pos = getChunkPosFromPos(pos);
|
||||
|
||||
// Get the chunks front tile
|
||||
chunks.get(c_pos).setDaylightLevel(light, pos);
|
||||
}
|
||||
|
||||
public void spawnEntity(Entity entity)
|
||||
{
|
||||
// Get the chunk pos
|
||||
|
|
@ -303,6 +284,8 @@ public class Layer implements IBdfClassManager
|
|||
Chunk chunk = new Chunk(this, cpos, chunk_nl.get("chunk"));
|
||||
dirty_chunks.set(cpos, chunk);
|
||||
}
|
||||
|
||||
layergen.init(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -310,18 +293,18 @@ public class Layer implements IBdfClassManager
|
|||
{
|
||||
BdfNamedList nl = bdf.getNamedList();
|
||||
|
||||
nl.set("lseed", BdfObject.withLong(lseed));
|
||||
nl.set("seed", BdfObject.withLong(seed));
|
||||
nl.set("id", BdfObject.withInteger(id));
|
||||
nl.set("lgen", BdfObject.withInteger(LayerGenerators.getLGID(this.layergen)));
|
||||
nl.set("lseed", bdf.newObject().setLong(lseed));
|
||||
nl.set("seed", bdf.newObject().setLong(seed));
|
||||
nl.set("id", bdf.newObject().setInteger(id));
|
||||
nl.set("lgen", bdf.newObject().setInteger(LayerGenerators.getLGID(this.layergen)));
|
||||
|
||||
BdfArray bdf_chunks = nl.get("chunks").getArray();
|
||||
|
||||
for(Map2DElement<Chunk> chunk : dirty_chunks) {
|
||||
BdfNamedList chunk_nl = new BdfNamedList();
|
||||
BdfNamedList chunk_nl = bdf.newNamedList();
|
||||
chunk.pos.BdfClassSave(chunk_nl.get("pos"));
|
||||
chunk.o.BdfClassSave(chunk_nl.get("chunk"));
|
||||
bdf_chunks.add(BdfObject.withNamedList(chunk_nl));
|
||||
bdf_chunks.add(bdf.newObject().setNamedList(chunk_nl));
|
||||
}
|
||||
|
||||
for(Map2DElement<Chunk> chunk : chunks) {
|
||||
|
|
@ -330,10 +313,10 @@ public class Layer implements IBdfClassManager
|
|||
if(!chunk.o.isDirty())
|
||||
continue;
|
||||
|
||||
BdfNamedList chunk_nl = new BdfNamedList();
|
||||
BdfNamedList chunk_nl = bdf.newNamedList();
|
||||
chunk.pos.BdfClassSave(chunk_nl.get("pos"));
|
||||
chunk.o.BdfClassSave(chunk_nl.get("chunk"));
|
||||
bdf_chunks.add(BdfObject.withNamedList(chunk_nl));
|
||||
bdf_chunks.add(bdf.newObject().setNamedList(chunk_nl));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package projectzombie.world.layer.layergen;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
|
|
@ -19,7 +18,6 @@ import projectzombie.world.layer.Layer;
|
|||
|
||||
public class LayerGenBossArena extends LayerGen implements LayerGenRememberPlayerPos
|
||||
{
|
||||
private final Vec2i center = new Vec2i(0, 0);
|
||||
private final int size = 10;
|
||||
private Vec3d player_pos = new Vec3d(0, 0, 0);
|
||||
private Random rand = new Random();
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import projectzombie.util.math.ColorRange;
|
|||
import projectzombie.util.math.TileState;
|
||||
import projectzombie.util.math.random.NoiseGenerator;
|
||||
import projectzombie.util.math.random.NoiseGeneratorSimplex;
|
||||
import projectzombie.util.math.random.OpenSimplexNoise;
|
||||
import projectzombie.util.math.random.RandomHelpers;
|
||||
import projectzombie.world.World;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import projectzombie.Main;
|
|||
import projectzombie.entity.Entity;
|
||||
import projectzombie.entity.EntityZombie;
|
||||
import projectzombie.init.Tiles;
|
||||
import projectzombie.tiles.Tile;
|
||||
import projectzombie.time.GameTimer;
|
||||
import projectzombie.util.math.ColorRange;
|
||||
import projectzombie.util.math.TileState;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ import projectzombie.util.math.ColorRange;
|
|||
import projectzombie.util.math.TileState;
|
||||
import projectzombie.util.math.random.NoiseGenerator;
|
||||
import projectzombie.util.math.random.NoiseGeneratorSimplex;
|
||||
import projectzombie.util.math.random.OpenSimplexNoise;
|
||||
import projectzombie.util.math.random.RandomHelpers;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ vec3 color_grass_hot_dry = vec3(1, 0.6, 0);
|
|||
vec3 color_grass_cold_wet = vec3(0.075, 0.533, 0.047);
|
||||
vec3 color_grass_cold_dry = vec3(0.812, 0.761, 0);
|
||||
|
||||
float depth_c = 0.001;
|
||||
float depth_c = 0.0001;
|
||||
|
||||
float map(float x, float in_min, float in_max, float out_min, float out_max) {
|
||||
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
|
||||
|
|
@ -81,11 +81,11 @@ void main()
|
|||
|
||||
vec3 light_day = pSunDepth.z < (texture(depthmap, sunDepthTexPos).r * 2 - 1 + depth_c
|
||||
) ? lighting_day_high : lighting_day_low;
|
||||
vec3 light_src = vec3(1, 1, 1) * (scaleLight(max(0, light.g)) - abs(pLightMapPos.y) * 0.1);
|
||||
vec3 light_src = vec3(1, 1, 1) * (scaleLight(max(0, light.r)) - abs(pLightMapPos.y) * 0.1);
|
||||
vec4 rgb = vec4((pRGB % 64) / 64.0, ((pRGB >> 6) % 64) / 64.0, ((pRGB >> 12) % 64) / 64.0, 1);
|
||||
|
||||
vec4 color_grass = vec4(interpolate2RGB(
|
||||
smoothStep(light.b), smoothStep(light.a),
|
||||
smoothStep(light.g), smoothStep(light.b),
|
||||
color_grass_cold_dry, color_grass_hot_dry,
|
||||
color_grass_cold_wet, color_grass_hot_wet), 1);
|
||||
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 576 B |
|
|
@ -1,216 +1,232 @@
|
|||
./tile/hemp6.png
|
||||
./tile/hemp7.png
|
||||
./tile/hemp1.png
|
||||
./tile/rock.png
|
||||
./tile/rock_ice.png
|
||||
./tile/sapling3.png
|
||||
./tile/ladder.png
|
||||
./tile/tree_leaves_snow.png
|
||||
./tile/ice_wall.png
|
||||
./tile/water.png
|
||||
./tile/sandstone_wall.png
|
||||
./tile/ladder_up.png
|
||||
./tile/cactus4.png
|
||||
./tile/tall_grass.png
|
||||
./tile/cactus2.png
|
||||
./tile/grass_infested.png
|
||||
./tile/tree_branch_leaves.png
|
||||
./tile/dirt.png
|
||||
./tile/wall.png
|
||||
./tile/tree_base.png
|
||||
./tile/cactus1.png
|
||||
./tile/sapling4.png
|
||||
./tile/hemp3.png
|
||||
./tile/cactus_top.png
|
||||
./tile/tunnel_down.png
|
||||
./tile/stone.png
|
||||
./tile/snow.png
|
||||
./tile/boss_portal.png
|
||||
./tile/hemp4.png
|
||||
./tile/sand.png
|
||||
./tile/lantern.png
|
||||
./tile/ice.png
|
||||
./tile/sapling1.png
|
||||
./tile/chest.png
|
||||
./tile/hemp2.png
|
||||
./tile/hemp8.png
|
||||
./tile/cactus3.png
|
||||
./tile/lava.png
|
||||
./tile/tree_leaves.png
|
||||
./tile/hemp5.png
|
||||
./tile/lava_flow.png
|
||||
./tile/grass.png
|
||||
./tile/tree_branch.png
|
||||
./tile/sandstone.png
|
||||
./tile/tree_branch_leaves_snow.png
|
||||
./tile/rock_sandstone.png
|
||||
./tile/sapling2.png
|
||||
./text/char_question.png
|
||||
./text/char_l_a.png
|
||||
./text/char_u_j.png
|
||||
./text/char_l_u.png
|
||||
./text/char_u_s.png
|
||||
./text/char_l_s.png
|
||||
./text/char_apostrophe.png
|
||||
./text/char_plus.png
|
||||
./text/char_l_e.png
|
||||
./text/char_7.png
|
||||
./text/char_minus.png
|
||||
./text/char_u_r.png
|
||||
./text/char_u_l.png
|
||||
./text/char_obracket.png
|
||||
./text/char_pow.png
|
||||
./text/char_u_m.png
|
||||
./text/char_l_t.png
|
||||
./text/char_percent.png
|
||||
./text/char_l_y.png
|
||||
./text/char_0.png
|
||||
./text/char_4.png
|
||||
./text/char_l_r.png
|
||||
./text/char_l_m.png
|
||||
./text/char_cbracket.png
|
||||
./text/char_u_g.png
|
||||
./text/char_u_q.png
|
||||
./text/char_u_i.png
|
||||
./text/char_tilde.png
|
||||
./text/char_l_w.png
|
||||
./text/char_l_v.png
|
||||
./text/char_fslash.png
|
||||
./text/char_u_p.png
|
||||
./text/char_gthan.png
|
||||
./text/char_8.png
|
||||
./text/char_unknown.png
|
||||
./text/char_and.png
|
||||
./text/char_osbracket.png
|
||||
./text/char_u_n.png
|
||||
./text/char_l_i.png
|
||||
./text/char_u_y.png
|
||||
./text/char_l_p.png
|
||||
./text/char_lthan.png
|
||||
./text/char_l_g.png
|
||||
./text/char_bslash.png
|
||||
./text/char_1.png
|
||||
./text/char_u_z.png
|
||||
./text/char_l_f.png
|
||||
./text/char_u_w.png
|
||||
./text/char_9.png
|
||||
./text/char_l_x.png
|
||||
./text/char_ccbracket.png
|
||||
./text/char_l_o.png
|
||||
./text/char_equals.png
|
||||
./text/char_l_d.png
|
||||
./text/char_dollar.png
|
||||
./text/char_hashtag.png
|
||||
./text/char_l_q.png
|
||||
./text/char_u_o.png
|
||||
./text/char_6.png
|
||||
./text/char_u_d.png
|
||||
./text/char_u_e.png
|
||||
./text/char_exclamation.png
|
||||
./text/char_vertical.png
|
||||
./text/char_ocbracket.png
|
||||
./text/char_u_k.png
|
||||
./text/char_u_c.png
|
||||
./text/char_l_n.png
|
||||
./text/char_semicolon.png
|
||||
./text/char_u_b.png
|
||||
./text/char_u_f.png
|
||||
./text/char_l_h.png
|
||||
./text/char_l_k.png
|
||||
./text/char_u_t.png
|
||||
./text/char_3.png
|
||||
./text/char_u_v.png
|
||||
./text/char_u_h.png
|
||||
./text/char_quotation.png
|
||||
./text/char_u_a.png
|
||||
./text/char_l_b.png
|
||||
./text/char_underscore.png
|
||||
./text/char_u_x.png
|
||||
./text/char_comma.png
|
||||
./text/char_csbracket.png
|
||||
./text/char_l_l.png
|
||||
./text/char_5.png
|
||||
./text/char_star.png
|
||||
./text/char_colon.png
|
||||
./text/char_l_z.png
|
||||
./text/char_space.png
|
||||
./text/char_2.png
|
||||
./text/char_at.png
|
||||
./text/char_grave.png
|
||||
./text/char_l_j.png
|
||||
./text/char_fullstop.png
|
||||
./text/char_l_c.png
|
||||
./text/char_u_u.png
|
||||
./list.txt
|
||||
./item/log.png
|
||||
./item/rock.png
|
||||
./item/acorn.png
|
||||
./item/ammo_box.png
|
||||
./item/plant_fibre.png
|
||||
./item/hemp_seed.png
|
||||
./item/shield_upgrade.png
|
||||
./item/grappling_hook.png
|
||||
./item/log_snow.png
|
||||
./item/health_potion.png
|
||||
./item/snow_pile.png
|
||||
./item/gun_upgrade.png
|
||||
./item/sandstone.png
|
||||
./item/flint.png
|
||||
./player/player_white_front_moving.png
|
||||
./player/player_white_back_moving.png
|
||||
./player/player_black_back_moving.png
|
||||
./player/player_black_back_still.png
|
||||
./player/player_white_back_still.png
|
||||
./player/player_white_front_still.png
|
||||
./player/player_black_front_moving.png
|
||||
./player/player_black_front_still.png
|
||||
./player/player_black_back_moving.png
|
||||
./player/player_black_back_still.png
|
||||
./player/player_white_back_moving.png
|
||||
./player/player_white_front_moving.png
|
||||
./gui/pixel_white.png
|
||||
./gui/water.png
|
||||
./gui/gun.png
|
||||
./gui/button_delete.png
|
||||
./gui/button_delete_hover.png
|
||||
./gui/slot_armor_chest.png
|
||||
./gui/pixel_black.png
|
||||
./gui/slot_clothing_shirt.png
|
||||
./gui/button_play.png
|
||||
./gui/slot_armor_legs.png
|
||||
./gui/inventory.png
|
||||
./gui/selection_box.png
|
||||
./gui/label.png
|
||||
./gui/slot_clothing_pants.png
|
||||
./gui/health_empty.png
|
||||
./gui/hotbar_selected.png
|
||||
./gui/health_full.png
|
||||
./particle/smoke_trail.png
|
||||
./particle/water.png
|
||||
./particle/smoke_0.png
|
||||
./particle/smoke_1.png
|
||||
./particle/blood.png
|
||||
./particle/lava.png
|
||||
./particle/bullet.png
|
||||
./particle/smoke_2.png
|
||||
./particle/snow.png
|
||||
./particle/rain.png
|
||||
./particle/smoke_4.png
|
||||
./particle/smoke_3.png
|
||||
./particle/smoke_5.png
|
||||
./gui/temperature.png
|
||||
./gui/button_play_hover.png
|
||||
./gui/slot_armor_helmet.png
|
||||
./gui/slot_clothing_boots.png
|
||||
./gui/hotbar.png
|
||||
./gui/button_normal.png
|
||||
./gui/shield.png
|
||||
./gui/slot_armor_chest.png
|
||||
./gui/health_empty.png
|
||||
./gui/button_hover.png
|
||||
./text/char_bslash.png
|
||||
./text/char_dollar.png
|
||||
./text/char_l_w.png
|
||||
./text/char_u_d.png
|
||||
./text/char_u_t.png
|
||||
./text/char_space.png
|
||||
./text/char_l_x.png
|
||||
./text/char_l_k.png
|
||||
./text/char_6.png
|
||||
./text/char_unknown.png
|
||||
./text/char_comma.png
|
||||
./text/char_obracket.png
|
||||
./text/char_u_w.png
|
||||
./text/char_7.png
|
||||
./text/char_l_f.png
|
||||
./text/char_vertical.png
|
||||
./text/char_plus.png
|
||||
./text/char_u_a.png
|
||||
./text/char_9.png
|
||||
./text/char_u_k.png
|
||||
./text/char_u_n.png
|
||||
./text/char_percent.png
|
||||
./text/char_u_m.png
|
||||
./text/char_exclamation.png
|
||||
./text/char_1.png
|
||||
./text/char_l_q.png
|
||||
./text/char_l_z.png
|
||||
./text/char_l_h.png
|
||||
./text/char_u_c.png
|
||||
./text/char_l_g.png
|
||||
./text/char_l_s.png
|
||||
./text/char_fullstop.png
|
||||
./text/char_u_j.png
|
||||
./text/char_l_m.png
|
||||
./text/char_l_t.png
|
||||
./text/char_u_v.png
|
||||
./text/char_colon.png
|
||||
./text/char_l_i.png
|
||||
./text/char_l_y.png
|
||||
./text/char_u_l.png
|
||||
./text/char_u_e.png
|
||||
./text/char_5.png
|
||||
./text/char_2.png
|
||||
./text/char_3.png
|
||||
./text/char_l_p.png
|
||||
./text/char_fslash.png
|
||||
./text/char_l_u.png
|
||||
./text/char_u_f.png
|
||||
./text/char_u_u.png
|
||||
./text/char_l_e.png
|
||||
./text/char_l_l.png
|
||||
./text/char_u_g.png
|
||||
./text/char_u_q.png
|
||||
./text/char_u_b.png
|
||||
./text/char_l_o.png
|
||||
./text/char_minus.png
|
||||
./text/char_l_v.png
|
||||
./text/char_lthan.png
|
||||
./text/char_u_s.png
|
||||
./text/char_equals.png
|
||||
./text/char_8.png
|
||||
./text/char_underscore.png
|
||||
./text/char_u_x.png
|
||||
./text/char_0.png
|
||||
./text/char_l_d.png
|
||||
./text/char_l_c.png
|
||||
./text/char_l_j.png
|
||||
./text/char_u_z.png
|
||||
./text/char_u_h.png
|
||||
./text/char_hashtag.png
|
||||
./text/char_gthan.png
|
||||
./text/char_cbracket.png
|
||||
./text/char_u_i.png
|
||||
./text/char_question.png
|
||||
./text/char_u_o.png
|
||||
./text/char_u_y.png
|
||||
./text/char_l_r.png
|
||||
./text/char_l_b.png
|
||||
./text/char_l_a.png
|
||||
./text/char_l_n.png
|
||||
./text/char_u_p.png
|
||||
./text/char_u_r.png
|
||||
./text/char_4.png
|
||||
./entity/armored_zombie_back_moving.png
|
||||
./entity/zombie_front_still.png
|
||||
./entity/tnt.png
|
||||
./gui/water.png
|
||||
./gui/slot_armor_legs.png
|
||||
./gui/selection_box_big.png
|
||||
./gui/button_normal.png
|
||||
./gui/label.png
|
||||
./gui/hotbar.png
|
||||
./gui/slot_armor_helmet.png
|
||||
./gui/button_delete.png
|
||||
./gui/text_cursor.png
|
||||
./gui/inventory.png
|
||||
./gui/button_delete_hover.png
|
||||
./gui/button_play_hover.png
|
||||
./gui/health_full.png
|
||||
./gui/hotbar_selected.png
|
||||
./gui/slot_clothing_shirt.png
|
||||
./gui/pixel_white.png
|
||||
./gui/pixel_black.png
|
||||
./gui/slot_clothing_pants.png
|
||||
./gui/text_box.png
|
||||
./gui/shield.png
|
||||
./gui/slot_clothing_boots.png
|
||||
./gui/selection_box_wide.png
|
||||
./gui/gun.png
|
||||
./gui/button_play.png
|
||||
./tile/cactus4.png
|
||||
./tile/hemp1.png
|
||||
./tile/dirt.png
|
||||
./tile/lantern.png
|
||||
./tile/hemp8.png
|
||||
./tile/wall.png
|
||||
./tile/cactus_top.png
|
||||
./tile/cactus2.png
|
||||
./tile/rock.png
|
||||
./tile/water.png
|
||||
./tile/hemp4.png
|
||||
./tile/stone.png
|
||||
./tile/tree_leaves.png
|
||||
./tile/sapling2.png
|
||||
./tile/ladder_up.png
|
||||
./tile/sapling3.png
|
||||
./tile/lava_flow.png
|
||||
./tile/ice_wall.png
|
||||
./tile/grass.png
|
||||
./tile/chest.png
|
||||
./tile/sapling4.png
|
||||
./tile/lava.png
|
||||
./tile/tall_grass.png
|
||||
./tile/hemp5.png
|
||||
./tile/sapling1.png
|
||||
./tile/snow.png
|
||||
./tile/sandstone_wall.png
|
||||
./tile/rock_sandstone.png
|
||||
./tile/hemp6.png
|
||||
./tile/cactus1.png
|
||||
./tile/tree_branch_leaves.png
|
||||
./tile/tunnel_down.png
|
||||
./tile/tree_branch_leaves_snow.png
|
||||
./tile/tree_leaves_snow.png
|
||||
./tile/rock_ice.png
|
||||
./tile/boss_portal.png
|
||||
./tile/ladder.png
|
||||
./tile/hemp7.png
|
||||
./tile/grass_infested.png
|
||||
./tile/tree_branch.png
|
||||
./tile/sand.png
|
||||
./tile/tree_base.png
|
||||
./tile/cactus3.png
|
||||
./tile/sandstone.png
|
||||
./tile/hemp3.png
|
||||
./tile/hemp2.png
|
||||
./tile/ice.png
|
||||
./entity/flare.png
|
||||
./entity/boss1/boss_walking.png
|
||||
./entity/grappling_hook.png
|
||||
./entity/zombie_back_moving.png
|
||||
./entity/tnt.png
|
||||
./entity/armored_zombie_back_moving.png
|
||||
./entity/armored_zombie_front_moving.png
|
||||
./entity/player/hair_side.png
|
||||
./entity/player/head_top.png
|
||||
./entity/player/head_side.png
|
||||
./entity/player/head_back.png
|
||||
./entity/player/head_bottom.png
|
||||
./entity/player/hair_front.png
|
||||
./entity/player/head_front.png
|
||||
./entity/player/hair_back.png
|
||||
./entity/player/hair_top.png
|
||||
./entity/dummy.png
|
||||
./entity/armored_zombie_front_still.png
|
||||
./entity/armored_zombie_back_still.png
|
||||
./entity/zombie_front_moving.png
|
||||
./entity/boss1/boss_walking_firing.png
|
||||
./entity/boss1/boss_firing.png
|
||||
./entity/boss1/boss_still.png
|
||||
./entity/boss1/boss_walking_firing.png
|
||||
./entity/armored_zombie_back_still.png
|
||||
./entity/armored_zombie_front_moving.png
|
||||
./entity/player/head_back.png
|
||||
./entity/player/hair_top.png
|
||||
./entity/player/head_front.png
|
||||
./entity/player/head_top.png
|
||||
./entity/player/hair_side.png
|
||||
./entity/player/head_side.png
|
||||
./entity/player/hair_back.png
|
||||
./entity/player/hair_front.png
|
||||
./entity/player/head_bottom.png
|
||||
./entity/grappling_hook.png
|
||||
./entity/boss1/boss_walking.png
|
||||
./entity/zombie_back_still.png
|
||||
./entity/dummy.png
|
||||
./entity/zombie_back_moving.png
|
||||
./entity/armored_zombie_front_still.png
|
||||
./entity/zombie_front_moving.png
|
||||
./particle/smoke_1.png
|
||||
./particle/water.png
|
||||
./particle/rain.png
|
||||
./particle/blood.png
|
||||
./particle/snow.png
|
||||
./particle/smoke_3.png
|
||||
./particle/smoke_4.png
|
||||
./particle/smoke_2.png
|
||||
./particle/smoke_0.png
|
||||
./particle/bullet.png
|
||||
./particle/lava.png
|
||||
./particle/smoke_trail.png
|
||||
./particle/smoke_5.png
|
||||
./entity/zombie_front_still.png
|
||||
./item/acorn.png
|
||||
./item/grappling_hook.png
|
||||
./item/gun_upgrade.png
|
||||
./item/shield_upgrade.png
|
||||
./item/rock.png
|
||||
./item/log.png
|
||||
./item/log_snow.png
|
||||
./item/hemp_seed.png
|
||||
./item/ammo_box.png
|
||||
./item/plant_fibre.png
|
||||
./item/health_potion.png
|
||||
./item/snow_pile.png
|
||||
./item/flint.png
|
||||
./item/sandstone.png
|
||||
|
|
|
|||
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.1 KiB |