mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-04-18 02:06:43 +00:00
parent
fe0be03ab8
commit
70a55dce59
@ -13,7 +13,7 @@ public class Cubot extends GameObject implements Updatable, ControllableUnit {
|
||||
private static final char MAP_INFO = 0x0080;
|
||||
public static final int ID = 1;
|
||||
|
||||
private char hologram = 0;
|
||||
private int hologram = 0;
|
||||
private String hologramString = "";
|
||||
private HologramMode hologramMode = HologramMode.CLEARED;
|
||||
|
||||
@ -88,7 +88,7 @@ public class Cubot extends GameObject implements Updatable, ControllableUnit {
|
||||
json.put("heldItem", heldItem);
|
||||
json.put("hp", hp);
|
||||
json.put("action", lastAction.ordinal());
|
||||
json.put("holo", (int) hologram);
|
||||
json.put("holo", hologram);
|
||||
json.put("holoStr", hologramString);
|
||||
json.put("holoMode", lastHologramMode.ordinal());
|
||||
json.put("energy", energy);
|
||||
@ -158,7 +158,7 @@ public class Cubot extends GameObject implements Updatable, ControllableUnit {
|
||||
return currentAction;
|
||||
}
|
||||
|
||||
public void setHologram(char hologram) {
|
||||
public void setHologram(int hologram) {
|
||||
this.hologram = hologram;
|
||||
}
|
||||
|
||||
@ -223,7 +223,9 @@ public class Cubot extends GameObject implements Updatable, ControllableUnit {
|
||||
public enum HologramMode {
|
||||
CLEARED,
|
||||
HEX,
|
||||
STRING
|
||||
STRING,
|
||||
DEC,
|
||||
COLOR
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,6 +20,8 @@ public class CubotHologram extends CpuHardware {
|
||||
private static final int CLEAR = 0;
|
||||
private static final int DISPLAY_HEX = 1;
|
||||
private static final int DISPLAY_STRING = 2;
|
||||
private static final int DISPLAY_DEC = 3;
|
||||
private static final int DISPLAY_COLOR = 4;
|
||||
|
||||
private static final int STR_MAX_LEN = 8;
|
||||
|
||||
@ -57,6 +59,21 @@ public class CubotHologram extends CpuHardware {
|
||||
|
||||
cubot.setHologramString(holoString.toString());
|
||||
cubot.setHologramMode(Cubot.HologramMode.STRING);
|
||||
} else if (a == DISPLAY_DEC) {
|
||||
//Display decimal number
|
||||
char b = getCpu().getRegisterSet().getRegister("B").getValue();
|
||||
cubot.setHologram(b);
|
||||
cubot.setHologramMode(Cubot.HologramMode.DEC);
|
||||
|
||||
} else if (a == DISPLAY_COLOR) {
|
||||
|
||||
if (cubot.spendEnergy(4)) {
|
||||
int b = getCpu().getRegisterSet().getRegister("B").getValue();
|
||||
int c = getCpu().getRegisterSet().getRegister("C").getValue();
|
||||
|
||||
cubot.setHologramMode(Cubot.HologramMode.COLOR);
|
||||
cubot.setHologram((c | (b << 16)) & 0x00FFFFFF); //B:C, ignore first byte
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public class Util {
|
||||
}
|
||||
|
||||
public static String toHex(int a) {
|
||||
return String.format("%04X ", uShort(a));
|
||||
return String.format("%04X ", a);
|
||||
}
|
||||
|
||||
public static String toHex(byte[] byteArray) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user