Package net.mtrop.doom.demo
Class Demo.Tic
java.lang.Object
net.mtrop.doom.demo.Demo.Tic
- Enclosing class:
- Demo
Demo tic abstraction.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final int
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final int
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte
actionButton
(boolean fire, boolean use) Returns the action byte for action buttons.static byte
actionButton
(boolean fire, boolean use, boolean changeWeapon, int weapon) Returns the action byte for action buttons.static byte
actionLoad
(int slot) Returns the action byte for loading a game.static byte
static byte
static byte
actionSave
(int slot) Returns the action byte for saving a game.static Demo.Tic
create
(int forward, int rightStrafe, int turnLeft, byte action) Creates a game tic.byte
int
Returns forward movement units.int
Returns right strafe units.int
Returns left turn units.toString()
-
Field Details
-
WEAPON_SHIFT
public static final int WEAPON_SHIFT- See Also:
-
SAVE_SHIFT
public static final int SAVE_SHIFT- See Also:
-
ACTION_FIRE
public static final byte ACTION_FIRE- See Also:
-
ACTION_USE
public static final byte ACTION_USE- See Also:
-
ACTION_CHANGE_WEAPON
public static final byte ACTION_CHANGE_WEAPON- See Also:
-
ACTION_SPECIAL
public static final byte ACTION_SPECIAL- See Also:
-
WEAPON_1
public static final byte WEAPON_1- See Also:
-
WEAPON_2
public static final byte WEAPON_2- See Also:
-
WEAPON_3
public static final byte WEAPON_3- See Also:
-
WEAPON_4
public static final byte WEAPON_4- See Also:
-
WEAPON_5
public static final byte WEAPON_5- See Also:
-
WEAPON_6
public static final byte WEAPON_6- See Also:
-
WEAPON_7
public static final byte WEAPON_7- See Also:
-
WEAPON_8
public static final byte WEAPON_8- See Also:
-
ACTION_SPECIAL_LOAD
public static final byte ACTION_SPECIAL_LOAD- See Also:
-
ACTION_SPECIAL_PAUSE
public static final byte ACTION_SPECIAL_PAUSE- See Also:
-
ACTION_SPECIAL_SAVE
public static final byte ACTION_SPECIAL_SAVE- See Also:
-
ACTION_SPECIAL_RESTART
public static final byte ACTION_SPECIAL_RESTART- See Also:
-
-
Method Details
-
create
Creates a game tic. Entered values are clamped to the byte range.- Parameters:
forward
- the forward movement amount (-127 to 127). Negative values = backwards movement.rightStrafe
- the right strafe movement amount (-127 to 127). Negative values = strafe left.turnLeft
- the left turn movement amount (-127 to 127, or -32767 to 32767 on long tics). Negative values = turn right.action
- the action byte.- Returns:
- a new demo tic.
-
actionButton
public static byte actionButton(boolean fire, boolean use) Returns the action byte for action buttons.- Parameters:
fire
- true if set, false if not.use
- true if set, false if not.- Returns:
- the action byte value.
-
actionButton
public static byte actionButton(boolean fire, boolean use, boolean changeWeapon, int weapon) Returns the action byte for action buttons.- Parameters:
fire
- true if set, false if not.use
- true if set, false if not.changeWeapon
- true if set, false if not.weapon
- the weapon number.- Returns:
- the action byte value.
-
actionSave
public static byte actionSave(int slot) Returns the action byte for saving a game.- Parameters:
slot
- the save slot to save the game to.- Returns:
- the action byte value.
-
actionLoad
public static byte actionLoad(int slot) Returns the action byte for loading a game.- Parameters:
slot
- the load slot to load the game from.- Returns:
- the action byte value.
-
actionPause
public static byte actionPause()- Returns:
- the action byte for pressing pause.
-
actionRestart
public static byte actionRestart()- Returns:
- the action byte for restarting the map.
-
getForwardMovement
public int getForwardMovement()Returns forward movement units. Negative values are backwards.- Returns:
- the unit value.
-
getRightStrafe
public int getRightStrafe()Returns right strafe units. Negative values are left strafes.- Returns:
- the unit value.
-
getTurnLeft
public int getTurnLeft()Returns left turn units. Negative values are right turns.- Returns:
- the unit value.
-
getAction
public byte getAction()- Returns:
- the action bits on this tic.
-
toString
-