Skip to content

Commit 776134b

Browse files
committed
implement draws
1 parent 6ec022e commit 776134b

File tree

10 files changed

+366
-153
lines changed

10 files changed

+366
-153
lines changed

src/main/java/JavaBWAPIBackend/Client.java

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public class Client {
1919
private LittleEndianPipe pipe;
2020

2121
public static class UnitCommand {
22+
final int type, unit, target, x, y, extra;
23+
2224
public UnitCommand(int type, int unit, int target, int x, int y, int extra) {
2325
this.type = type;
2426
this.unit = unit;
@@ -27,20 +29,38 @@ public UnitCommand(int type, int unit, int target, int x, int y, int extra) {
2729
this.y = y;
2830
this.extra = extra;
2931
}
30-
int type, unit, target, x, y, extra;
3132
private static final int SIZE = 24;
3233
}
3334

3435
public static class Command {
36+
final int type, value1, value2;
37+
3538
public Command(int type, int value1, int value2) {
3639
this.type = type;
3740
this.value1 = value1;
3841
this.value2 = value2;
3942
}
40-
int type, value1, value2;
4143
private static final int SIZE = 12;
4244
}
4345

46+
public static class Shape {
47+
final int type, coordType, x1, y1, x2, y2, extra1, extra2, color, isSolid;
48+
49+
public Shape(int type, int coordType, int x1, int y1, int x2, int y2, int extra1, int extra2, int color, int isSolid) {
50+
this.type = type;
51+
this.coordType = coordType;
52+
this.x1 = x1;
53+
this.y1 = y1;
54+
this.x2 = x2;
55+
this.y2 = y2;
56+
this.extra1 = extra1;
57+
this.extra2 = extra2;
58+
this.color = color;
59+
this.isSolid = isSolid;
60+
}
61+
private static final int SIZE = 40;
62+
}
63+
4464
public final class GameData {
4565
private String parseString(int offset, int maxLen) {
4666
byte[] buf = new byte[maxLen];
@@ -304,7 +324,6 @@ public class BulletData {
304324
public int remainingLatencyFrames() { return sharedMemory.getInt(GameOffset + 16); }
305325
public int remainingLatencyTime() { return sharedMemory.getInt(GameOffset + 20); }
306326
public boolean hasLatCom() { return sharedMemory.get(GameOffset + 24) != 0; }
307-
public void setLatcom(boolean enable) { sharedMemory.put(GameOffset + 24, (byte)(enable ? 1 : 0)); }
308327
public boolean hasGUI() { return sharedMemory.get(GameOffset + 25) != 0; }
309328
public int replayFrameCount() { return sharedMemory.getInt(GameOffset + 28); }
310329
public int randomSeed() { return sharedMemory.getInt(GameOffset + 32); }
@@ -431,15 +450,6 @@ public int addString(String s) {
431450

432451
private static final int ShapeOffset = 0x1dfc6c8;
433452

434-
public class Shape {
435-
int type, coordType, x1, y1, x2, y2, extra1, extra2, color, isSolid;
436-
Shape(int type, int coordType, int x1, int y1, int x2, int y2, int extra1, int extra2, int color, int isSolid)
437-
{ this.type = type; this.coordType = coordType; this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2;
438-
this.extra1 = extra1; this.extra2 = extra2; this.color = color; this.isSolid = isSolid; }
439-
440-
private static final int SIZE = 40;
441-
}
442-
443453
public void addShape(Shape shape) {
444454
int at = sharedMemory.getInt(ShapeOffset);
445455
sharedMemory.putInt(ShapeOffset + at * Shape.SIZE + 4, shape.type);

0 commit comments

Comments
 (0)