src/viewport.h
author rubidium
Wed, 19 Sep 2007 16:36:42 +0000
changeset 8097 68eefbb4ff46
parent 8076 10e9b5e354d9
child 8155 db4561087736
permissions -rw-r--r--
(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.
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2116
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2116
diff changeset
     2
6919
339210ecccd3 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6574
diff changeset
     3
/** @file viewport.h */
339210ecccd3 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6574
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
7120
e31767effc16 (svn r9844) -Codechange: replace zoomlevel with an enum
truelight
parents: 6919
diff changeset
     8
#include "zoom.hpp"
e31767effc16 (svn r9844) -Codechange: replace zoomlevel with an enum
truelight
parents: 6919
diff changeset
     9
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    10
struct ViewPort {
4344
5d0e40cd67b9 (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
    11
	int left,top;                       // screen coordinates for the viewport
5d0e40cd67b9 (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
    12
	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
    13
4344
5d0e40cd67b9 (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 virtual_left, virtual_top;      // virtual coordinates
5d0e40cd67b9 (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 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
    16
7120
e31767effc16 (svn r9844) -Codechange: replace zoomlevel with an enum
truelight
parents: 6919
diff changeset
    17
	ZoomLevel zoom;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    18
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    19
1990
90eb49e87b90 (svn r2496) -Fix: [1179933] When toggling build/remove via keyboard the selection wasn't correctly redrawn
tron
parents: 1977
diff changeset
    20
void SetSelectionRed(bool);
90eb49e87b90 (svn r2496) -Fix: [1179933] When toggling build/remove via keyboard the selection wasn't correctly redrawn
tron
parents: 1977
diff changeset
    21
6919
339210ecccd3 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6574
diff changeset
    22
/* viewport.cpp */
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5919
diff changeset
    23
void InitViewports();
5122
a68d16b055fa (svn r7202) -Codechange: Move _viewports and _active_viewports local to viewport.c and have them
Darkvater
parents: 5046
diff changeset
    24
void DeleteWindowViewport(Window *w);
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 152
diff changeset
    25
void AssignWindowViewport(Window *w, int x, int y,
7120
e31767effc16 (svn r9844) -Codechange: replace zoomlevel with an enum
truelight
parents: 6919
diff changeset
    26
	int width, int height, uint32 follow_flags, ZoomLevel zoom);
2116
cdfc27b696b7 (svn r2626) static, const, misc.
tron
parents: 1990
diff changeset
    27
ViewPort *IsPtInWindowViewport(const Window *w, int x, int y);
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5919
diff changeset
    28
Point GetTileBelowCursor();
5044
7e70387677e5 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    29
void UpdateViewportPosition(Window *w);
7e70387677e5 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    30
7e70387677e5 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    31
enum {
7e70387677e5 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    32
	ZOOM_IN   = 0,
7e70387677e5 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    33
	ZOOM_OUT  = 1,
7e70387677e5 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    34
	ZOOM_NONE = 2, // hack, used to update the button status
7e70387677e5 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    35
};
7e70387677e5 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    36
7e70387677e5 (svn r7093) -Codechange: Move DoZoomInOutWindow declaration to viewport.h and rewrite the function
Darkvater
parents: 5026
diff changeset
    37
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
    38
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
    39
Point GetTileZoomCenterWindow(bool in, Window * w);
5045
3e734e178dae (svn r7094) -Codechange: Get rid of the window-specific code in DoZoomInOutWindow (enable, disable
Darkvater
parents: 5044
diff changeset
    40
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
    41
5046
2b2375affc0a (svn r7095) -Codechange: Move MaxZoomIn function to viewport.h and change it to MaxZoomInOut
Darkvater
parents: 5045
diff changeset
    42
static inline void MaxZoomInOut(int how, Window *w)
2b2375affc0a (svn r7095) -Codechange: Move MaxZoomIn function to viewport.h and change it to MaxZoomInOut
Darkvater
parents: 5045
diff changeset
    43
{
7814
fe643468ad64 (svn r10673) -Cleanup: some assorted style cleanups. Primarily type* var -> type *var.
rubidium
parents: 7502
diff changeset
    44
	while (DoZoomInOutWindow(how, w)) {};
5046
2b2375affc0a (svn r7095) -Codechange: Move MaxZoomIn function to viewport.h and change it to MaxZoomInOut
Darkvater
parents: 5045
diff changeset
    45
}
2b2375affc0a (svn r7095) -Codechange: Move MaxZoomIn function to viewport.h and change it to MaxZoomInOut
Darkvater
parents: 5045
diff changeset
    46
8097
68eefbb4ff46 (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: 8076
diff changeset
    47
/**
68eefbb4ff46 (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: 8076
diff changeset
    48
 * Some values for constructing bounding boxes (BB). The Z positions under bridges are:
68eefbb4ff46 (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: 8076
diff changeset
    49
 * z=0..5  Everything that can be built under low bridges.
68eefbb4ff46 (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: 8076
diff changeset
    50
 * z=6     reserved, currently unused.
68eefbb4ff46 (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: 8076
diff changeset
    51
 * z=7     Z separator between bridge/tunnel and the things under/above it.
68eefbb4ff46 (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: 8076
diff changeset
    52
 */
68eefbb4ff46 (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: 8076
diff changeset
    53
enum {
68eefbb4ff46 (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: 8076
diff changeset
    54
	BB_HEIGHT_UNDER_BRIDGE = 6, ///< Everything that can be built under low bridges, must not exceed this Z height.
68eefbb4ff46 (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: 8076
diff changeset
    55
	BB_Z_SEPARATOR  = 7,        ///< Separates the bridge/tunnel from the things under/above it.
68eefbb4ff46 (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: 8076
diff changeset
    56
};
68eefbb4ff46 (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: 8076
diff changeset
    57
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    58
void OffsetGroundSprite(int x, int y);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    59
5919
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5838
diff changeset
    60
void DrawGroundSprite(SpriteID image, SpriteID pal);
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5838
diff changeset
    61
void DrawGroundSpriteAt(SpriteID image, SpriteID pal, int32 x, int32 y, byte z);
8076
10e9b5e354d9 (svn r11105) -Codechange [FS#1223]: add some support for tuning of the bounding boxes for some special cases (like tunnels and bridges). Patch by frosch.
rubidium
parents: 7829
diff changeset
    62
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);
7502
71f5d2c6a605 (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: 7165
diff changeset
    63
void *AddStringToDraw(int x, int y, StringID string, uint64 params_1, uint64 params_2);
5919
2b58160d667d (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5838
diff changeset
    64
void AddChildSpriteScreen(SpriteID image, SpriteID pal, int x, int y);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    65
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    66
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5919
diff changeset
    67
void StartSpriteCombine();
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5919
diff changeset
    68
void EndSpriteCombine();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    69
2116
cdfc27b696b7 (svn r2626) static, const, misc.
tron
parents: 1990
diff changeset
    70
void HandleViewportClicked(const ViewPort *vp, int x, int y);
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5919
diff changeset
    71
void PlaceObject();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    72
void SetRedErrorSquare(TileIndex tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    73
void SetTileSelectSize(int w, int h);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    74
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
    75
7165
37eb253f3c06 (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents: 7120
diff changeset
    76
void VpStartPlaceSizing(TileIndex tile, byte method, byte process);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    77
void VpSetPresizeRange(uint from, uint to);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    78
void VpSetPlaceSizingLimit(int limit);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    79
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 5919
diff changeset
    80
Vehicle *CheckMouseOverVehicle();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    81
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    82
enum {
4344
5d0e40cd67b9 (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
    83
	VPM_X_OR_Y          = 0,
5d0e40cd67b9 (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
    84
	VPM_FIX_X           = 1,
5d0e40cd67b9 (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
    85
	VPM_FIX_Y           = 2,
5d0e40cd67b9 (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
    86
	VPM_RAILDIRS        = 3,
5d0e40cd67b9 (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
    87
	VPM_X_AND_Y         = 4,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    88
	VPM_X_AND_Y_LIMITED = 5,
4344
5d0e40cd67b9 (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
    89
	VPM_SIGNALDIRS      = 6
1070
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
    90
};
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
    91
6919
339210ecccd3 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6574
diff changeset
    92
/* viewport highlight mode (for highlighting tiles below cursor) */
1070
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
    93
enum {
6919
339210ecccd3 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6574
diff changeset
    94
	VHM_NONE    = 0, ///< default
339210ecccd3 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6574
diff changeset
    95
	VHM_RECT    = 1, ///< rectangle (stations, depots, ...)
339210ecccd3 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6574
diff changeset
    96
	VHM_POINT   = 2, ///< point (lower land, raise land, level land, ...)
339210ecccd3 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6574
diff changeset
    97
	VHM_SPECIAL = 3, ///< special mode used for highlighting while dragging (and for tunnels/docks)
339210ecccd3 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6574
diff changeset
    98
	VHM_DRAG    = 4, ///< dragging items in the depot windows
339210ecccd3 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6574
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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   102
void VpSelectTilesWithMethod(int x, int y, int method);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   103
6919
339210ecccd3 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6574
diff changeset
   104
/* highlighting draw styles */
4799
a32af5dd7b6c (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
   105
typedef byte HighLightStyle;
a32af5dd7b6c (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
   106
enum HighLightStyles {
4344
5d0e40cd67b9 (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
   107
	HT_NONE   = 0x00,
5d0e40cd67b9 (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
   108
	HT_RECT   = 0x80,
5d0e40cd67b9 (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
   109
	HT_POINT  = 0x40,
6919
339210ecccd3 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6574
diff changeset
   110
	HT_LINE   = 0x20,    ///< used for autorail highlighting (longer streches)
339210ecccd3 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6574
diff changeset
   111
	                     ///< (uses lower bits to indicate direction)
339210ecccd3 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6574
diff changeset
   112
	HT_RAIL   = 0x10,    ///< autorail (one piece)
339210ecccd3 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6574
diff changeset
   113
	                     ///< (uses lower bits to indicate direction)
4799
a32af5dd7b6c (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
   114
	HT_DRAG_MASK = 0xF0, ///< masks the drag-type
1070
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
   115
1109
1bab892228cd (svn r1610) Remove trailing whitespace (last time ever, i hope)
tron
parents: 1093
diff changeset
   116
	/* lower bits (used with HT_LINE and HT_RAIL):
1070
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
   117
	 * (see ASCII art in autorail.h for a visual interpretation) */
4799
a32af5dd7b6c (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
   118
	HT_DIR_X  = 0,    ///< X direction
a32af5dd7b6c (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
   119
	HT_DIR_Y  = 1,    ///< Y direction
a32af5dd7b6c (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
   120
	HT_DIR_HU = 2,    ///< horizontal upper
a32af5dd7b6c (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
   121
	HT_DIR_HL = 3,    ///< horizontal lower
a32af5dd7b6c (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
   122
	HT_DIR_VL = 4,    ///< vertical left
a32af5dd7b6c (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
   123
	HT_DIR_VR = 5,    ///< vertical right
a32af5dd7b6c (svn r6721) -Codechange: some comments, aligning, types and variable localization.
Darkvater
parents: 4344
diff changeset
   124
	HT_DIR_MASK = 0x7 ///< masks the drag-direction
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   125
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   126
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   127
struct TileHighlightData {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   128
	Point size;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   129
	Point outersize;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   130
	Point pos;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   131
	Point offs;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   132
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   133
	Point new_pos;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   134
	Point new_size;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   135
	Point new_outersize;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   136
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   137
	Point selend, selstart;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   138
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   139
	byte dirty;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   140
	byte sizelimit;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   141
1070
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
   142
	byte drawstyle;      // lower bits 0-3 are reserved for detailed highlight information information
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
   143
	byte new_drawstyle;  // only used in UpdateTileSelection() to as a buffer to compare if there was a change between old and new
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents: 873
diff changeset
   144
	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
   145
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   146
	byte place_mode;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   147
	bool make_square_red;
873
46e892485be3 (svn r1354) Use WindowClass/WindowNumber to store/pass window class/number, not some arbitrary data types
tron
parents: 849
diff changeset
   148
	WindowClass window_class;
46e892485be3 (svn r1354) Use WindowClass/WindowNumber to store/pass window class/number, not some arbitrary data types
tron
parents: 849
diff changeset
   149
	WindowNumber window_number;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   150
7165
37eb253f3c06 (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents: 7120
diff changeset
   151
	byte select_method;
37eb253f3c06 (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents: 7120
diff changeset
   152
	byte select_proc;
37eb253f3c06 (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents: 7120
diff changeset
   153
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   154
	TileIndex redsq;
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   155
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   156
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   157
6919
339210ecccd3 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6574
diff changeset
   158
/* common button handler */
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
   159
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, int mode, PlaceProc *placeproc);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   160
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   161
VARDEF Point _tile_fract_coords;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   162
1863
610acc8bc189 (svn r2369) Remove _thd_ptr: It always holds the address of _thd
tron
parents: 1109
diff changeset
   163
extern TileHighlightData _thd;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   164
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   165
430
75820dedf4f1 (svn r631) Merge r440, r444, r485, r630 to trunk:
tron
parents: 193
diff changeset
   166
void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom);
75820dedf4f1 (svn r631) Merge r440, r444, r485, r630 to trunk:
tron
parents: 193
diff changeset
   167
75820dedf4f1 (svn r631) Merge r440, r444, r485, r630 to trunk:
tron
parents: 193
diff changeset
   168
#endif /* VIEWPORT_H */