maedhros@6343: /* $Id$ */ maedhros@6343: rubidium@9111: /** @file landscape.h Functions related to OTTD's landscape. */ maedhros@6343: maedhros@6453: #ifndef LANDSCAPE_H maedhros@6453: #define LANDSCAPE_H maedhros@6453: rubidium@8121: #include "core/geometry_type.hpp" rubidium@8138: #include "tile_cmd.h" rubidium@8138: #include "slope_type.h" rubidium@8138: #include "direction_type.h" rubidium@8119: maedhros@6343: enum { maedhros@6343: SNOW_LINE_MONTHS = 12, maedhros@6343: SNOW_LINE_DAYS = 32, maedhros@6343: }; maedhros@6343: maedhros@6343: struct SnowLine { maedhros@6343: byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]; maedhros@6343: byte highest_value; maedhros@6343: }; maedhros@6343: maedhros@6343: bool IsSnowLineSet(void); maedhros@6343: void SetSnowLine(byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]); maedhros@6343: byte GetSnowLine(void); maedhros@6343: byte HighestSnowLine(void); maedhros@6343: void ClearSnowLine(void); maedhros@6453: maedhros@6453: uint GetPartialZ(int x, int y, Slope corners); maedhros@6453: uint GetSlopeZ(int x, int y); rubidium@7728: void GetSlopeZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2); rubidium@7770: int GetSlopeZInCorner(Slope tileh, Corner corner); frosch@8380: Slope GetFoundationSlope(TileIndex tile, uint* z); maedhros@6453: maedhros@6453: static inline Point RemapCoords(int x, int y, int z) maedhros@6453: { maedhros@6453: Point pt; maedhros@6453: pt.x = (y - x) * 2; maedhros@6453: pt.y = y + x - z; maedhros@6453: return pt; maedhros@6453: } maedhros@6453: maedhros@6453: static inline Point RemapCoords2(int x, int y) maedhros@6453: { maedhros@6453: return RemapCoords(x, y, GetSlopeZ(x, y)); maedhros@6453: } maedhros@6453: rubidium@7335: uint ApplyFoundationToSlope(Foundation f, Slope *s); rubidium@7335: void DrawFoundation(TileInfo *ti, Foundation f); maedhros@6453: maedhros@6453: void DoClearSquare(TileIndex tile); maedhros@6453: void RunTileLoop(); maedhros@6453: maedhros@6453: void InitializeLandscape(); maedhros@6453: void GenerateLandscape(byte mode); maedhros@6453: maedhros@6453: TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng); maedhros@6453: maedhros@6453: #endif /* LANDSCAPE_H */