00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef VIEWPORT_FUNC_H
00013 #define VIEWPORT_FUNC_H
00014
00015 #include "gfx_type.h"
00016 #include "viewport_type.h"
00017 #include "window_type.h"
00018 #include "tile_type.h"
00019 #include "station_type.h"
00020
00021 static const int TILE_HEIGHT_STEP = 50;
00022
00023 void SetSelectionRed(bool);
00024
00025 void DeleteWindowViewport(Window *w);
00026 void InitializeWindowViewport(Window *w, int x, int y, int width, int height, uint32 follow_flags, ZoomLevel zoom);
00027 ViewPort *IsPtInWindowViewport(const Window *w, int x, int y);
00028 Point GetTileBelowCursor();
00029 void UpdateViewportPosition(Window *w);
00030
00031 void MarkAllViewportsDirty(int left, int top, int right, int bottom);
00032
00033 bool DoZoomInOutWindow(ZoomStateChange how, Window *w);
00034 void ZoomInOrOutToCursorWindow(bool in, Window * w);
00035 Point GetTileZoomCenterWindow(bool in, Window * w);
00036 void HandleZoomMessage(Window *w, const ViewPort *vp, byte widget_zoom_in, byte widget_zoom_out);
00037
00044 static inline void MaxZoomInOut(ZoomStateChange how, Window *w)
00045 {
00046 while (DoZoomInOutWindow(how, w)) {};
00047 }
00048
00049 void OffsetGroundSprite(int x, int y);
00050
00051 void DrawGroundSprite(SpriteID image, PaletteID pal, const SubSprite *sub = NULL, int extra_offs_x = 0, int extra_offs_y = 0);
00052 void DrawGroundSpriteAt(SpriteID image, PaletteID pal, int32 x, int32 y, int z, const SubSprite *sub = NULL, int extra_offs_x = 0, int extra_offs_y = 0);
00053 void AddSortableSpriteToDraw(SpriteID image, PaletteID 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);
00054 void AddChildSpriteScreen(SpriteID image, PaletteID pal, int x, int y, bool transparent = false, const SubSprite *sub = NULL, bool scale = true);
00055 void ViewportAddString(const DrawPixelInfo *dpi, ZoomLevel small_from, const ViewportSign *sign, StringID string_normal, StringID string_small, StringID string_small_shadow, uint64 params_1, uint64 params_2 = 0, Colours colour = INVALID_COLOUR);
00056
00057
00058 void StartSpriteCombine();
00059 void EndSpriteCombine();
00060
00061 bool HandleViewportClicked(const ViewPort *vp, int x, int y);
00062 void SetRedErrorSquare(TileIndex tile);
00063 void SetTileSelectSize(int w, int h);
00064 void SetTileSelectBigSize(int ox, int oy, int sx, int sy);
00065
00066 void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom);
00067
00068 bool ScrollWindowToTile(TileIndex tile, Window *w, bool instant = false);
00069 bool ScrollWindowTo(int x, int y, int z, Window *w, bool instant = false);
00070
00071 void RebuildViewportOverlay(Window *w);
00072
00073 bool ScrollMainWindowToTile(TileIndex tile, bool instant = false);
00074 bool ScrollMainWindowTo(int x, int y, int z = -1, bool instant = false);
00075
00076 void UpdateAllVirtCoords();
00077
00078 extern Point _tile_fract_coords;
00079
00080 void MarkTileDirtyByTile(TileIndex tile);
00081
00082 Point GetViewportStationMiddle(const ViewPort *vp, const Station *st);
00083
00084 #endif