This file was deleted.

@@ -20,16 +20,8 @@
package fr.veridiangames.core.network.packets;

import java.net.InetAddress;
import java.util.List;
import java.util.Map;

import fr.veridiangames.core.GameCore;
import fr.veridiangames.core.game.entities.Entity;
import fr.veridiangames.core.game.entities.bullets.StaticBullet;
import fr.veridiangames.core.game.entities.player.Player;
import fr.veridiangames.core.game.entities.player.ServerPlayer;
import fr.veridiangames.core.maths.Quat;
import fr.veridiangames.core.maths.Vec3;
import fr.veridiangames.core.network.NetworkableClient;
import fr.veridiangames.core.network.NetworkableServer;
import fr.veridiangames.core.utils.DataBuffer;
@@ -96,6 +96,10 @@ public void process(NetworkableServer server, InetAddress address, int port)
server.getCore().getGame().spawn(new ServerPlayer(id, name, position, rotation, address.getHostName(), port));
server.log(name + " just connected !");
server.sendToAll(new ConnectPacket(this));
for (int i = 0; i < server.getCore().getGame().getWorld().getModifiedBlocks().size(); i++)
{
System.out.println("COLOR: " + Integer.toHexString(server.getCore().getGame().getWorld().getModifiedBlocks().get(i).w));
}
server.send(new SyncBlocksPacket(server.getCore().getGame().getWorld().getModifiedBlocks()), address, port);

for (int i = 0; i < server.getCore().getGame().getEntityManager().getNetworkableEntites().size(); i++)
@@ -37,7 +37,7 @@
public static final int BLOCK_ACTION = 0x04;
public static final int BLOCK_SYNC = 0x05;
public static final int WEAPON_POS = 0x06;
public static final int BULLET_HIT = 0x07;
public static final int BULLET_HIT_BLOCK = 0x07;
public static final int PARTICLES_SPAWN = 0x08;
public static final int PARTICLES_REMOVE = 0x09;
public static final int BULLET_HIT_PLAYER = 0x0A;
@@ -79,7 +79,7 @@ public void process(NetworkableServer server, InetAddress address, int port)
p.setLife(100);
p.setDead(false);

this.position = new Vec3(800, 8, 800); // TODO : Modify position
this.position = new Vec3(800, 20, 800); // TODO : Modify position

server.send(new RespawnPacket(this), p.getNetwork().getAddress(), p.getNetwork().getPort());
}
@@ -50,6 +50,8 @@ public SyncBlocksPacket(List<Vec4i> blocks)
data.put(b.y);
data.put(b.z);
data.put(b.w);

System.out.println("BLOCK: " + Integer.toHexString(b.w));
}
data.flip();
}
@@ -75,6 +77,7 @@ public void read(DataBuffer data)
for (int i = 0; i < size; i++)
{
Vec4i block = new Vec4i(data.getInt(), data.getInt(), data.getInt(), data.getInt());
System.out.println("BLOCK: " + Integer.toHexString(block.w));
blocks.add(block);
}
}
@@ -106,7 +106,7 @@ public Color4f(float r, float g, float b, float a) {
this.a = a;
}

public Color4f(Vec3 hsl)
/*public Color4f(Vec3 hsl)
{
float r, g, b;
float h = hsl.x;
@@ -175,7 +175,7 @@ public Vec3 getHSL()
}
return new Vec3(h, s, l);
}
}*/

public static int getColor(int r, int g, int b, int a)
{
@@ -222,10 +222,9 @@ public static Color4f sLerp(Color4f ca, Color4f cb, float t) {
public static Color4f mix(Color4f ca, Color4f cb, float t) {
float r = Math.abs(ca.r + (cb.r - ca.r) * t);
float g = Math.abs(ca.g + (cb.g - ca.g) * t);
float b = Math.abs(ca.b + (cb.b - ca.b) * t);
float a = Math.abs(ca.a + (cb.a - ca.a) * t);

return new Color4f(r, g, b, a);
float b = Math.abs(ca.b + (cb.b - ca.b) * t);

return new Color4f(r, g, b, ca.getAlpha());
}

public float[] toArray() {
@@ -268,18 +267,18 @@ public void setAlpha(float alpha) {
this.a = alpha;
}

public int getRGB() {
/*public int getRGB() {
int R = (int) (r*255f);
int G = (int) (g*255f);
int B = (int) (b*255f);
int rgb = 0;
rgb = R << 16 | G << 8 | B;
return rgb;
}
}*/

public int getARGB() {
int A = (int) (a*255f);
int A = (int) (a*127f);
int R = (int) (r*255f);
int G = (int) (g*255f);
int B = (int) (b*255f);
@@ -330,6 +329,21 @@ public Color4f mul(Color4f v) {
b *= v.b;
return this;
}

public static Color4f getColorFromARGB(int argb){
Color4f color = new Color4f(0, 0, 0, 0);
int A = (argb & 0xff000000)>>24;
int R = (argb & 0xff0000)>>16;
int G = (argb & 0xff00)>>8;
int B = (argb & 0xff);

color.r = (float) R/255f;
color.g = (float) G/255f;
color.b = (float) B/255f;
color.a = (float) A/127f;

return color;
}

public String toString()
{
@@ -35,6 +35,13 @@ public static void main(String[] args)
System.out.println("Start: " + x + " " + y + " " + z);
System.out.println("Index: " + index);
System.out.println("Solve: " + solve);

int color = 0x7fffffff; // INT encoder sur 4 octets
Color4f c = Color4f.getColorFromARGB(color);

System.out.println("Start: " + color);
System.out.println(": " + c);
System.out.println(": " + c.getARGB());
}

public static int index3i(Vec3i pos)