Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef LANDSCAPE_H
00013 #define LANDSCAPE_H
00014
00015 #include "core/geometry_type.hpp"
00016 #include "tile_cmd.h"
00017 #include "zoom_type.h"
00018
00019 static const uint SNOW_LINE_MONTHS = 12;
00020 static const uint SNOW_LINE_DAYS = 32;
00021
00026 struct SnowLine {
00027 byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS];
00028 byte highest_value;
00029 byte lowest_value;
00030 };
00031
00032 bool IsSnowLineSet();
00033 void SetSnowLine(byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]);
00034 byte GetSnowLine();
00035 byte HighestSnowLine();
00036 byte LowestSnowLine();
00037 void ClearSnowLine();
00038
00039 int GetSlopeZInCorner(Slope tileh, Corner corner);
00040 Slope GetFoundationSlope(TileIndex tile, int *z = NULL);
00041
00042 uint GetPartialPixelZ(int x, int y, Slope corners);
00043 int GetSlopePixelZ(int x, int y);
00044 void GetSlopePixelZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2);
00045
00055 static inline int GetSlopePixelZInCorner(Slope tileh, Corner corner)
00056 {
00057 return GetSlopeZInCorner(tileh, corner) * TILE_HEIGHT;
00058 }
00059
00068 static inline Slope GetFoundationPixelSlope(TileIndex tile, int *z)
00069 {
00070 assert(z != NULL);
00071 Slope s = GetFoundationSlope(tile, z);
00072 *z *= TILE_HEIGHT;
00073 return s;
00074 }
00075
00084 static inline Point RemapCoords(int x, int y, int z)
00085 {
00086 Point pt;
00087 pt.x = (y - x) * 2 * ZOOM_LVL_BASE;
00088 pt.y = (y + x - z) * ZOOM_LVL_BASE;
00089 return pt;
00090 }
00091
00100 static inline Point RemapCoords2(int x, int y)
00101 {
00102 return RemapCoords(x, y, GetSlopePixelZ(x, y));
00103 }
00104
00113 static inline Point InverseRemapCoords(int x, int y)
00114 {
00115 Point pt = {(y * 2 - x) >> (2 + ZOOM_LVL_SHIFT), (y * 2 + x) >> (2 + ZOOM_LVL_SHIFT)};
00116 return pt;
00117 }
00118
00119 uint ApplyFoundationToSlope(Foundation f, Slope *s);
00128 static inline uint ApplyPixelFoundationToSlope(Foundation f, Slope *s)
00129 {
00130 return ApplyFoundationToSlope(f, s) * TILE_HEIGHT;
00131 }
00132
00133 void DrawFoundation(TileInfo *ti, Foundation f);
00134 bool HasFoundationNW(TileIndex tile, Slope slope_here, uint z_here);
00135 bool HasFoundationNE(TileIndex tile, Slope slope_here, uint z_here);
00136
00137 void DoClearSquare(TileIndex tile);
00138 void RunTileLoop();
00139
00140 void InitializeLandscape();
00141 void GenerateLandscape(byte mode);
00142
00143 #endif