+#define UPWARD_VELOCITY_CLEARS_ONGROUND(s) STAT(GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND, s)
+
+#define PHYS_INPUT_BUTTON_ATCK(s) PHYS_INPUT_BUTTON_BUTTON1(s)
+#define PHYS_INPUT_BUTTON_JUMP(s) PHYS_INPUT_BUTTON_BUTTON2(s)
+#define PHYS_INPUT_BUTTON_ATCK2(s) PHYS_INPUT_BUTTON_BUTTON3(s)
+#define PHYS_INPUT_BUTTON_ZOOM(s) PHYS_INPUT_BUTTON_BUTTON4(s)
+#define PHYS_INPUT_BUTTON_CROUCH(s) PHYS_INPUT_BUTTON_BUTTON5(s)
+#define PHYS_INPUT_BUTTON_HOOK(s) PHYS_INPUT_BUTTON_BUTTON6(s)
+#define PHYS_INPUT_BUTTON_INFO(s) PHYS_INPUT_BUTTON_BUTTON7(s)
+#define PHYS_INPUT_BUTTON_DRAG(s) PHYS_INPUT_BUTTON_BUTTON8(s)
+#define PHYS_INPUT_BUTTON_USE(s) PHYS_INPUT_BUTTON_BUTTON_USE(s)
+#define PHYS_INPUT_BUTTON_CHAT(s) PHYS_INPUT_BUTTON_BUTTON_CHAT(s)
+#define PHYS_INPUT_BUTTON_PRYDON(s) PHYS_INPUT_BUTTON_BUTTON_PRYDON(s)
+#define PHYS_INPUT_BUTTON_ZOOMSCRIPT(s) PHYS_INPUT_BUTTON_BUTTON9(s)
+#define PHYS_INPUT_BUTTON_JETPACK(s) PHYS_INPUT_BUTTON_BUTTON10(s)
+
+// if more buttons are needed, start using impulse bits as buttons
+
+#define PHYS_INPUT_BUTTON_BACKWARD(s) (PHYS_INPUT_MOVEVALUES(s).x < 0)
+#define PHYS_INPUT_BUTTON_FORWARD(s) (PHYS_INPUT_MOVEVALUES(s).x > 0)
+#define PHYS_INPUT_BUTTON_LEFT(s) (PHYS_INPUT_MOVEVALUES(s).y < 0)
+#define PHYS_INPUT_BUTTON_RIGHT(s) (PHYS_INPUT_MOVEVALUES(s).y > 0)
+
+// used for special commands and idle checking, not from the engine
+// TODO: cache
+#define PHYS_INPUT_BUTTON_MASK(s) ( \
+ (1 << 0) * PHYS_INPUT_BUTTON_ATCK(s) \
+ | (1 << 1) * PHYS_INPUT_BUTTON_JUMP(s) \
+ | (1 << 2) * PHYS_INPUT_BUTTON_ATCK2(s) \
+ | (1 << 3) * PHYS_INPUT_BUTTON_ZOOM(s) \
+ | (1 << 4) * PHYS_INPUT_BUTTON_CROUCH(s) \
+ | (1 << 5) * PHYS_INPUT_BUTTON_HOOK(s) \
+ | (1 << 6) * PHYS_INPUT_BUTTON_USE(s) \
+ | (1 << 7) * PHYS_INPUT_BUTTON_BACKWARD(s) \
+ | (1 << 8) * PHYS_INPUT_BUTTON_FORWARD(s) \
+ | (1 << 9) * PHYS_INPUT_BUTTON_LEFT(s) \
+ | (1 << 10) * PHYS_INPUT_BUTTON_RIGHT(s) \
+ )
+
+#define IS_JUMP_HELD(s) (!((s).flags & FL_JUMPRELEASED))
+#define SET_JUMP_HELD(s) ((s).flags &= ~FL_JUMPRELEASED)
+#define UNSET_JUMP_HELD(s) ((s).flags |= FL_JUMPRELEASED)
+
+#define IS_ONGROUND(s) boolean((s).flags & FL_ONGROUND)
+#define SET_ONGROUND(s) ((s).flags |= FL_ONGROUND)
+#define UNSET_ONGROUND(s) ((s).flags &= ~FL_ONGROUND)
+
+#define WAS_ONGROUND(s) boolean((s).lastflags & FL_ONGROUND)
+
+#define ITEMS_STAT(s) ((s).items)