tron@2186: /* $Id$ */ tron@2186: rubidium@8720: /** @file viewport_type.h Types related to viewports. */ belugas@6919: rubidium@8720: #ifndef VIEWPORT_TYPE_H rubidium@8720: #define VIEWPORT_TYPE_H truelight@0: rubidium@8721: #include "core/geometry_type.hpp" rubidium@8619: #include "zoom_type.h" rubidium@8602: #include "window_type.h" rubidium@8720: #include "tile_type.h" truelight@7120: truelight@0: struct ViewPort { rubidium@4344: int left,top; // screen coordinates for the viewport rubidium@4344: int width, height; // screen width/height for the viewport truelight@0: rubidium@4344: int virtual_left, virtual_top; // virtual coordinates rubidium@4344: int virtual_width, virtual_height; // these are just width << zoom, height << zoom truelight@0: truelight@7120: ZoomLevel zoom; truelight@0: }; truelight@0: Darkvater@5044: enum { Darkvater@5044: ZOOM_IN = 0, Darkvater@5044: ZOOM_OUT = 1, Darkvater@5044: ZOOM_NONE = 2, // hack, used to update the button status Darkvater@5044: }; Darkvater@5044: rubidium@8097: /** rubidium@8097: * Some values for constructing bounding boxes (BB). The Z positions under bridges are: rubidium@8097: * z=0..5 Everything that can be built under low bridges. rubidium@8097: * z=6 reserved, currently unused. rubidium@8097: * z=7 Z separator between bridge/tunnel and the things under/above it. rubidium@8097: */ rubidium@8097: enum { rubidium@8097: BB_HEIGHT_UNDER_BRIDGE = 6, ///< Everything that can be built under low bridges, must not exceed this Z height. rubidium@8097: BB_Z_SEPARATOR = 7, ///< Separates the bridge/tunnel from the things under/above it. rubidium@8097: }; rubidium@8097: rubidium@8384: /** Viewport place method (type of highlighted area and placed objects) */ rubidium@8384: enum ViewportPlaceMethod { rubidium@8384: VPM_X_OR_Y = 0, ///< drag in X or Y direction rubidium@8384: VPM_FIX_X = 1, ///< drag only in X axis rubidium@8384: VPM_FIX_Y = 2, ///< drag only in Y axis rubidium@8384: VPM_RAILDIRS = 3, ///< all rail directions rubidium@8384: VPM_X_AND_Y = 4, ///< area of land in X and Y directions rubidium@8384: VPM_X_AND_Y_LIMITED = 5, ///< area of land of limited size rubidium@8384: VPM_SIGNALDIRS = 6, ///< similiar to VMP_RAILDIRS, but with different cursor dominik@1070: }; dominik@1070: smatz@8414: /** Viewport highlight mode (for highlighting tiles below cursor) */ rubidium@8385: enum ViewportHighlightMode { belugas@6919: VHM_NONE = 0, ///< default belugas@6919: VHM_RECT = 1, ///< rectangle (stations, depots, ...) belugas@6919: VHM_POINT = 2, ///< point (lower land, raise land, level land, ...) belugas@6919: VHM_SPECIAL = 3, ///< special mode used for highlighting while dragging (and for tunnels/docks) belugas@6919: VHM_DRAG = 4, ///< dragging items in the depot windows belugas@6919: VHM_RAIL = 5, ///< rail pieces truelight@0: }; truelight@0: belugas@6919: /* highlighting draw styles */ rubidium@8720: enum HighLightStyle { rubidium@4344: HT_NONE = 0x00, rubidium@4344: HT_RECT = 0x80, rubidium@4344: HT_POINT = 0x40, belugas@6919: HT_LINE = 0x20, ///< used for autorail highlighting (longer streches) belugas@6919: ///< (uses lower bits to indicate direction) belugas@6919: HT_RAIL = 0x10, ///< autorail (one piece) belugas@6919: ///< (uses lower bits to indicate direction) Darkvater@4799: HT_DRAG_MASK = 0xF0, ///< masks the drag-type dominik@1070: tron@1109: /* lower bits (used with HT_LINE and HT_RAIL): dominik@1070: * (see ASCII art in autorail.h for a visual interpretation) */ Darkvater@4799: HT_DIR_X = 0, ///< X direction Darkvater@4799: HT_DIR_Y = 1, ///< Y direction Darkvater@4799: HT_DIR_HU = 2, ///< horizontal upper Darkvater@4799: HT_DIR_HL = 3, ///< horizontal lower Darkvater@4799: HT_DIR_VL = 4, ///< vertical left Darkvater@4799: HT_DIR_VR = 5, ///< vertical right Darkvater@4799: HT_DIR_MASK = 0x7 ///< masks the drag-direction truelight@0: }; rubidium@8720: DECLARE_ENUM_AS_BIT_SET(HighLightStyle); rubidium@8720: truelight@0: rubidium@6574: struct TileHighlightData { truelight@0: Point size; truelight@0: Point outersize; truelight@0: Point pos; truelight@0: Point offs; truelight@0: truelight@0: Point new_pos; truelight@0: Point new_size; truelight@0: Point new_outersize; truelight@0: truelight@0: Point selend, selstart; truelight@0: truelight@0: byte dirty; truelight@0: byte sizelimit; truelight@0: dominik@1070: byte drawstyle; // lower bits 0-3 are reserved for detailed highlight information information dominik@1070: byte new_drawstyle; // only used in UpdateTileSelection() to as a buffer to compare if there was a change between old and new dominik@1070: byte next_drawstyle; // queued, but not yet drawn style truelight@0: smatz@8414: ViewportHighlightMode place_mode; truelight@0: bool make_square_red; tron@873: WindowClass window_class; tron@873: WindowNumber window_number; truelight@0: rubidium@8384: ViewportPlaceMethod select_method; maedhros@7165: byte select_proc; maedhros@7165: truelight@0: TileIndex redsq; rubidium@6574: }; truelight@0: rubidium@8720: #endif /* VIEWPORT_TYPE_H */