src/viewport.h
author rubidium
Tue, 25 Dec 2007 11:26:07 +0000
changeset 8131 160939e24ed3
parent 8123 ce31d2843a95
child 8138 dbfdc08fa6b9
permissions -rw-r--r--
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2116
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2116
diff changeset
     2
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
     3
/** @file viewport.h */
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
     4
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
#ifndef VIEWPORT_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     6
#define VIEWPORT_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents: 8121
diff changeset
     8
#include "zoom_type.h"
8106
e6790dd9e750 (svn r11667) -Codechange: split window.h into a header that defines some 'global' window related types, on that defined 'global' window functions and one that defines functions and types only used by *_gui.cpps.
rubidium
parents: 7918
diff changeset
     9
#include "window_type.h"
8119
52b48108425a (svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium
parents: 8106
diff changeset
    10
#include "vehicle_type.h"
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents: 8121
diff changeset
    11
#include "gfx_func.h"
6624
880e29b1f25e (svn r9844) -Codechange: replace zoomlevel with an enum
truelight
parents: 6423
diff changeset
    12
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    13
struct ViewPort {
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 2817
diff changeset
    14
	int left,top;                       // screen coordinates for the viewport
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 2817
diff changeset
    15
	int width, height;                  // screen width/height for the viewport
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    16
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 2817
diff changeset
    17
	int virtual_left, virtual_top;      // virtual coordinates
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 2817
diff changeset
    18
	int virtual_width, virtual_height;  // these are just width << zoom, height << zoom
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    19
6624
880e29b1f25e (svn r9844) -Codechange: replace zoomlevel with an enum
truelight
parents: 6423
diff changeset
    20
	ZoomLevel zoom;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    21
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    22
1990
efb67f977138 (svn r2496) -Fix: [1179933] When toggling build/remove via keyboard the selection wasn't correctly redrawn
tron
parents: 1977
diff changeset
    23
void SetSelectionRed(bool);
efb67f977138 (svn r2496) -Fix: [1179933] When toggling build/remove via keyboard the selection wasn't correctly redrawn
tron
parents: 1977
diff changeset
    24
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
    25
/* viewport.cpp */
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5668
diff changeset
    26
void InitViewports();
5122
3aa375cb5e8e (svn r7202) -Codechange: Move _viewports and _active_viewports local to viewport.c and have them
Darkvater
parents: 5046
diff changeset
    27
void DeleteWindowViewport(Window *w);
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 152
diff changeset
    28
void AssignWindowViewport(Window *w, int x, int y,
6624
880e29b1f25e (svn r9844) -Codechange: replace zoomlevel with an enum
truelight
parents: 6423
diff changeset
    29
	int width, int height, uint32 follow_flags, ZoomLevel zoom);
2116
23031555ff54 (svn r2626) static, const, misc.
tron
parents: 1990
diff changeset
    30
ViewPort *IsPtInWindowViewport(const Window *w, int x, int y);
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5668
diff changeset
    31
Point GetTileBelowCursor();
5044
e4e5bcdd79c6 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    32
void UpdateViewportPosition(Window *w);
e4e5bcdd79c6 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    33
e4e5bcdd79c6 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    34
enum {
e4e5bcdd79c6 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    35
	ZOOM_IN   = 0,
e4e5bcdd79c6 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    36
	ZOOM_OUT  = 1,
e4e5bcdd79c6 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    37
	ZOOM_NONE = 2, // hack, used to update the button status
e4e5bcdd79c6 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    38
};
e4e5bcdd79c6 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    39
e4e5bcdd79c6 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    40
bool DoZoomInOutWindow(int how, Window *w);
152
c3964b43943e (svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents: 133
diff changeset
    41
void ZoomInOrOutToCursorWindow(bool in, Window * w);
c3964b43943e (svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents: 133
diff changeset
    42
Point GetTileZoomCenterWindow(bool in, Window * w);
5045
846098142ffe (svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents: 5044
diff changeset
    43
void HandleZoomMessage(Window *w, const ViewPort *vp, byte widget_zoom_in, byte widget_zoom_out);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    44
5046
d2c53a73b580 (svn r7095) -Codechange: Move MaxZoomIn function to viewport.h and change it to MaxZoomInOut
Darkvater
parents: 5045
diff changeset
    45
static inline void MaxZoomInOut(int how, Window *w)
d2c53a73b580 (svn r7095) -Codechange: Move MaxZoomIn function to viewport.h and change it to MaxZoomInOut
Darkvater
parents: 5045
diff changeset
    46
{
7318
632cd0497770 (svn r10673) -Cleanup: some assorted style cleanups. Primarily type* var -> type *var.
rubidium
parents: 7006
diff changeset
    47
	while (DoZoomInOutWindow(how, w)) {};
5046
d2c53a73b580 (svn r7095) -Codechange: Move MaxZoomIn function to viewport.h and change it to MaxZoomInOut
Darkvater
parents: 5045
diff changeset
    48
}
d2c53a73b580 (svn r7095) -Codechange: Move MaxZoomIn function to viewport.h and change it to MaxZoomInOut
Darkvater
parents: 5045
diff changeset
    49
7601
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    50
/**
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    51
 * Some values for constructing bounding boxes (BB). The Z positions under bridges are:
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    52
 * z=0..5  Everything that can be built under low bridges.
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    53
 * z=6     reserved, currently unused.
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    54
 * z=7     Z separator between bridge/tunnel and the things under/above it.
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    55
 */
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    56
enum {
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    57
	BB_HEIGHT_UNDER_BRIDGE = 6, ///< Everything that can be built under low bridges, must not exceed this Z height.
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    58
	BB_Z_SEPARATOR  = 7,        ///< Separates the bridge/tunnel from the things under/above it.
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    59
};
988040ee27f4 (svn r11128) -Fix: a lot of graphical glitches by changing some bounding boxes. It's not perfect yet, but a *very* good step into the right direction. Patch by frosch.
rubidium
parents: 7580
diff changeset
    60
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    61
void OffsetGroundSprite(int x, int y);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    62
7681
582e8912e8d1 (svn r11212) -Codechange: add support for drawing parts of sprites. Patch by frosch.
rubidium
parents: 7659
diff changeset
    63
void DrawGroundSprite(SpriteID image, SpriteID pal, const SubSprite *sub = NULL);
582e8912e8d1 (svn r11212) -Codechange: add support for drawing parts of sprites. Patch by frosch.
rubidium
parents: 7659
diff changeset
    64
void DrawGroundSpriteAt(SpriteID image, SpriteID pal, int32 x, int32 y, byte z, const SubSprite *sub = NULL);
582e8912e8d1 (svn r11212) -Codechange: add support for drawing parts of sprites. Patch by frosch.
rubidium
parents: 7659
diff changeset
    65
void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w, int h, int dz, int z, bool transparent = false, int bb_offset_x = 0, int bb_offset_y = 0, int bb_offset_z = 0, const SubSprite *sub = NULL);
7006
bfa3974da32b (svn r10262) -Fix (r10258): some places that needed to be changed to uint64 were hidden/forgotten, which caused memory corruptions and that in caused all kinds of assertions to trigger.
rubidium
parents: 6669
diff changeset
    66
void *AddStringToDraw(int x, int y, StringID string, uint64 params_1, uint64 params_2);
7681
582e8912e8d1 (svn r11212) -Codechange: add support for drawing parts of sprites. Patch by frosch.
rubidium
parents: 7659
diff changeset
    67
void AddChildSpriteScreen(SpriteID image, SpriteID pal, int x, int y, bool transparent = false, const SubSprite *sub = NULL);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    68
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    69
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5668
diff changeset
    70
void StartSpriteCombine();
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5668
diff changeset
    71
void EndSpriteCombine();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    72
2116
23031555ff54 (svn r2626) static, const, misc.
tron
parents: 1990
diff changeset
    73
void HandleViewportClicked(const ViewPort *vp, int x, int y);
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5668
diff changeset
    74
void PlaceObject();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    75
void SetRedErrorSquare(TileIndex tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    76
void SetTileSelectSize(int w, int h);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    77
void SetTileSelectBigSize(int ox, int oy, int sx, int sy);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    78
6247
7d81e3a5d803 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5668
diff changeset
    79
Vehicle *CheckMouseOverVehicle();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    80
7888
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
    81
/** Viewport place method (type of highlighted area and placed objects) */
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
    82
enum ViewportPlaceMethod {
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
    83
	VPM_X_OR_Y          = 0, ///< drag in X or Y direction
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
    84
	VPM_FIX_X           = 1, ///< drag only in X axis
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
    85
	VPM_FIX_Y           = 2, ///< drag only in Y axis
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
    86
	VPM_RAILDIRS        = 3, ///< all rail directions
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
    87
	VPM_X_AND_Y         = 4, ///< area of land in X and Y directions
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
    88
	VPM_X_AND_Y_LIMITED = 5, ///< area of land of limited size
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
    89
	VPM_SIGNALDIRS      = 6, ///< similiar to VMP_RAILDIRS, but with different cursor
1070
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
    90
};
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
    91
7918
970e7c5005e5 (svn r11471) -Codechange: one more variable retyped to enum ViewportHighlightMode
smatz
parents: 7889
diff changeset
    92
/** Viewport highlight mode (for highlighting tiles below cursor) */
7889
e74ce8853ba7 (svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents: 7888
diff changeset
    93
enum ViewportHighlightMode {
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
    94
	VHM_NONE    = 0, ///< default
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
    95
	VHM_RECT    = 1, ///< rectangle (stations, depots, ...)
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
    96
	VHM_POINT   = 2, ///< point (lower land, raise land, level land, ...)
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
    97
	VHM_SPECIAL = 3, ///< special mode used for highlighting while dragging (and for tunnels/docks)
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
    98
	VHM_DRAG    = 4, ///< dragging items in the depot windows
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
    99
	VHM_RAIL    = 5, ///< rail pieces
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   100
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   101
7888
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
   102
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method);
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
   103
void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, byte process);
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
   104
void VpSetPresizeRange(uint from, uint to);
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
   105
void VpSetPlaceSizingLimit(int limit);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   106
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
   107
/* highlighting draw styles */
4799
20311e38bedf (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
   108
typedef byte HighLightStyle;
20311e38bedf (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
   109
enum HighLightStyles {
4344
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 2817
diff changeset
   110
	HT_NONE   = 0x00,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 2817
diff changeset
   111
	HT_RECT   = 0x80,
7e123fec5b0b (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 2817
diff changeset
   112
	HT_POINT  = 0x40,
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
   113
	HT_LINE   = 0x20,    ///< used for autorail highlighting (longer streches)
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
   114
	                     ///< (uses lower bits to indicate direction)
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
   115
	HT_RAIL   = 0x10,    ///< autorail (one piece)
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
   116
	                     ///< (uses lower bits to indicate direction)
4799
20311e38bedf (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
   117
	HT_DRAG_MASK = 0xF0, ///< masks the drag-type
1070
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
   118
1109
ecb98f43ba2c (svn r1610) Remove trailing whitespace (last time ever, i hope)
tron
parents: 1093
diff changeset
   119
	/* lower bits (used with HT_LINE and HT_RAIL):
1070
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
   120
	 * (see ASCII art in autorail.h for a visual interpretation) */
4799
20311e38bedf (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
   121
	HT_DIR_X  = 0,    ///< X direction
20311e38bedf (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
   122
	HT_DIR_Y  = 1,    ///< Y direction
20311e38bedf (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
   123
	HT_DIR_HU = 2,    ///< horizontal upper
20311e38bedf (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
   124
	HT_DIR_HL = 3,    ///< horizontal lower
20311e38bedf (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
   125
	HT_DIR_VL = 4,    ///< vertical left
20311e38bedf (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
   126
	HT_DIR_VR = 5,    ///< vertical right
20311e38bedf (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
   127
	HT_DIR_MASK = 0x7 ///< masks the drag-direction
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   128
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   129
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6247
diff changeset
   130
struct TileHighlightData {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   131
	Point size;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   132
	Point outersize;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   133
	Point pos;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   134
	Point offs;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   135
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   136
	Point new_pos;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   137
	Point new_size;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   138
	Point new_outersize;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   139
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   140
	Point selend, selstart;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   141
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   142
	byte dirty;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   143
	byte sizelimit;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   144
1070
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
   145
	byte drawstyle;      // lower bits 0-3 are reserved for detailed highlight information information
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
   146
	byte new_drawstyle;  // only used in UpdateTileSelection() to as a buffer to compare if there was a change between old and new
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
   147
	byte next_drawstyle; // queued, but not yet drawn style
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   148
7918
970e7c5005e5 (svn r11471) -Codechange: one more variable retyped to enum ViewportHighlightMode
smatz
parents: 7889
diff changeset
   149
	ViewportHighlightMode place_mode;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   150
	bool make_square_red;
873
732553f5b169 (svn r1354) Use WindowClass/WindowNumber to store/pass window class/number, not some arbitrary data types
tron
parents: 849
diff changeset
   151
	WindowClass window_class;
732553f5b169 (svn r1354) Use WindowClass/WindowNumber to store/pass window class/number, not some arbitrary data types
tron
parents: 849
diff changeset
   152
	WindowNumber window_number;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   153
7888
a28f4cfff934 (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 7681
diff changeset
   154
	ViewportPlaceMethod select_method;
6669
bb48a810a509 (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents: 6624
diff changeset
   155
	byte select_proc;
bb48a810a509 (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents: 6624
diff changeset
   156
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   157
	TileIndex redsq;
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6247
diff changeset
   158
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   159
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   160
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6248
diff changeset
   161
/* common button handler */
7889
e74ce8853ba7 (svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents: 7888
diff changeset
   162
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, ViewportHighlightMode mode, PlaceProc *placeproc);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   163
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   164
VARDEF Point _tile_fract_coords;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   165
1863
74a8379bb868 (svn r2369) Remove _thd_ptr: It always holds the address of _thd
tron
parents: 1109
diff changeset
   166
extern TileHighlightData _thd;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   167
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   168
430
2e9a2e9fcf11 (svn r631) Merge r440, r444, r485, r630 to trunk:
tron
parents: 193
diff changeset
   169
void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom);
2e9a2e9fcf11 (svn r631) Merge r440, r444, r485, r630 to trunk:
tron
parents: 193
diff changeset
   170
8121
3bc6351e7369 (svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents: 8119
diff changeset
   171
void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, ViewportHighlightMode mode, Window *w);
3bc6351e7369 (svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents: 8119
diff changeset
   172
void SetObjectToPlace(CursorID icon, SpriteID pal, ViewportHighlightMode mode, WindowClass window_class, WindowNumber window_num);
3bc6351e7369 (svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents: 8119
diff changeset
   173
3bc6351e7369 (svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents: 8119
diff changeset
   174
void ResetObjectToPlace();
3bc6351e7369 (svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents: 8119
diff changeset
   175
3bc6351e7369 (svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents: 8119
diff changeset
   176
bool ScrollWindowTo(int x, int y, Window *w, bool instant = false);
3bc6351e7369 (svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents: 8119
diff changeset
   177
3bc6351e7369 (svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents: 8119
diff changeset
   178
bool ScrollMainWindowToTile(TileIndex tile, bool instant = false);
3bc6351e7369 (svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents: 8119
diff changeset
   179
bool ScrollMainWindowTo(int x, int y, bool instant = false);
3bc6351e7369 (svn r11682) -Codechange: move some 'generic' geometry related types into a single file and do not include gfx.h everywhere to get a Point type.
rubidium
parents: 8119
diff changeset
   180
430
2e9a2e9fcf11 (svn r631) Merge r440, r444, r485, r630 to trunk:
tron
parents: 193
diff changeset
   181
#endif /* VIEWPORT_H */