(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.

pull/155/head
rubidium 17 years ago
parent 342ad858e5
commit 64d691bacc

@ -36,6 +36,7 @@
#include "variables.h"
#include "autoreplace_func.h"
#include "autoreplace_gui.h"
#include "gfx_func.h"
void Aircraft::UpdateDeltaXY(Direction direction)
{

@ -10,13 +10,13 @@
#include "table/strings.h"
#include "gui.h"
#include "engine.h"
#include "viewport.h"
#include "player.h"
#include "depot.h"
#include "vehicle_gui.h"
#include "newgrf_engine.h"
#include "strings_func.h"
#include "vehicle_func.h"
#include "gfx_func.h"
/**
* Draw the details for the given vehicle at the position (x,y)

@ -10,7 +10,6 @@
#include "gui.h"
#include "station_gui.h"
#include "terraform_gui.h"
#include "viewport.h"
#include "command_func.h"
#include "station.h"
#include "airport.h"
@ -18,6 +17,8 @@
#include "sound_func.h"
#include "window_func.h"
#include "variables.h"
#include "viewport_func.h"
#include "gfx_func.h"
static byte _selected_airport_type;

@ -18,6 +18,7 @@
#include "window_func.h"
#include "vehicle_func.h"
#include "autoreplace_func.h"
#include "gfx_func.h"
static RailType _railtype_selected_in_replace_gui;

@ -7,7 +7,6 @@
#include "table/strings.h"
#include "gui.h"
#include "window_gui.h"
#include "viewport.h"
#include "command_func.h"
#include "economy_func.h"
#include "variables.h"
@ -16,6 +15,8 @@
#include "window_func.h"
#include "sound_func.h"
#include "map_func.h"
#include "viewport_func.h"
#include "gfx_func.h"
static struct BridgeData {
uint8 last_size;

@ -30,6 +30,7 @@
#include "date_func.h"
#include "vehicle_func.h"
#include "settings_type.h"
#include "gfx_func.h"
struct buildvehicle_d {
VehicleType vehicle_type;

@ -7,7 +7,6 @@
#include "clear_map.h"
#include "table/strings.h"
#include "player.h"
#include "viewport.h"
#include "command_func.h"
#include "bridge.h"
#include "landscape.h"
@ -21,6 +20,7 @@
#include "functions.h"
#include "economy_func.h"
#include "table/clear_land.h"
#include "viewport_func.h"
static CommandCost ClearTile_Clear(TileIndex tile, byte flags)
{

@ -19,6 +19,7 @@
#include "core/alloc_func.hpp"
#include "window_func.h"
#include "string_func.h"
#include "gfx_func.h"
#define ICON_BUFFER 79
#define ICON_HISTORY_SIZE 20

@ -12,7 +12,8 @@
#include "table/sprites.h"
#include "gui.h"
#include "textbuf_gui.h"
#include "viewport.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "command_func.h"
#include "depot.h"
#include "vehicle_gui.h"

@ -12,13 +12,14 @@
#include "terraform_gui.h"
#include "window_gui.h"
#include "station_gui.h"
#include "viewport.h"
#include "command_func.h"
#include "variables.h"
#include "water.h"
#include "window_func.h"
#include "vehicle_func.h"
#include "sound_func.h"
#include "viewport_func.h"
#include "gfx_func.h"
static void ShowBuildDockStationPicker();
static void ShowBuildDocksDepotPicker();

@ -43,6 +43,7 @@
#include "track_type.h"
#include "track_func.h"
#include "rail_map.h"
#include "gfx_func.h"
/**
* Multiply two integer values and shift the results to right.

@ -48,7 +48,7 @@
#include "stdafx.h"
#include "openttd.h"
#include "station_map.h"
#include "viewport.h"
#include "viewport_func.h"
#include "variables.h" /* ... same here */
#include "landscape.h"
#include "rail_type.h"

@ -8,7 +8,7 @@
#include "table/sprites.h"
#include "gui.h"
#include "window_gui.h"
#include "viewport.h"
#include "gfx_func.h"
#include "engine.h"
#include "command_func.h"
#include "economy_func.h"

@ -26,6 +26,7 @@
#include "sound_func.h"
#include "fios.h"
#include "string_func.h"
#include "gfx_func.h"
/**
* In what 'mode' the GenerateLandscapeWindowProc is.

@ -16,6 +16,7 @@
#include "core/alloc_func.hpp"
#include "window_func.h"
#include "date_func.h"
#include "gfx_func.h"
/* Bitmasks of player and cargo indices that shouldn't be drawn. */
static uint _legend_excluded_players;

@ -15,7 +15,6 @@
#include "depot.h"
#include "train.h"
#include "group.h"
#include "viewport.h"
#include "debug.h"
#include "strings_func.h"
#include "core/alloc_func.hpp"
@ -23,6 +22,8 @@
#include "vehicle_func.h"
#include "autoreplace_gui.h"
#include "string_func.h"
#include "viewport_func.h"
#include "gfx_func.h"
struct Sorting {

@ -49,13 +49,6 @@ void ShowBuildAirToolbar();
void ShowGenerateLandscape();
void ShowHeightmapLoad();
typedef void PlaceProc(TileIndex tile);
void PlaceProc_DemolishArea(TileIndex tile);
void PlaceProc_LevelLand(TileIndex tile);
void PlaceProc_BuyLand(TileIndex tile);
bool GUIPlaceProcDragXY(const WindowEvent *e);
VARDEF PlaceProc *_place_proc;
/** Drag and drop selection process, or, what to do with an area of land when
* you've selected it. */
enum {

@ -11,7 +11,8 @@
#include "window_gui.h"
#include "textbuf_gui.h"
#include "command_func.h"
#include "viewport.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "industry.h"
#include "town.h"
#include "variables.h"

@ -19,6 +19,7 @@
#include "strings_func.h"
#include "window_func.h"
#include "fios.h"
#include "gfx_func.h"
static const Widget _select_game_widgets[] = {
{ WWT_CAPTION, RESIZE_NONE, 13, 0, 335, 0, 13, STR_0307_OPENTTD, STR_NULL},

@ -13,7 +13,7 @@
#include "window_gui.h"
#include "window_func.h"
#include "textbuf_gui.h"
#include "viewport.h"
#include "viewport_func.h"
#include "player.h"
#include "command_func.h"
#include "news.h"

@ -18,7 +18,7 @@
#include "newgrf_house.h"
#include "cargotype.h"
#include "group.h"
#include "viewport.h"
#include "viewport_func.h"
#include "economy_func.h"
#include "zoom_func.h"
#include "functions.h"
@ -27,6 +27,8 @@
#include "vehicle_func.h"
#include "texteff.hpp"
#include "string_func.h"
#include "gfx_func.h"
char _name_array[512][32];

@ -18,7 +18,8 @@
#include "window_gui.h"
#include "station_gui.h"
#include "textbuf_gui.h"
#include "viewport.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "station.h"
#include "command_func.h"
#include "player.h"

@ -14,6 +14,8 @@
#include "strings_func.h"
#include "window_func.h"
#include "sound_func.h"
#include "gfx_func.h"
#include "core/math_func.hpp"
static byte _music_wnd_cursong;
static bool _song_is_active;

@ -26,6 +26,7 @@
#include "../window_func.h"
#include "../core/alloc_func.hpp"
#include "../string_func.h"
#include "../gfx_func.h"
#define BGC 5
#define BTC 15

@ -16,6 +16,7 @@
#include "window_func.h"
#include "core/alloc_func.hpp"
#include "string_func.h"
#include "gfx_func.h"
/** Parse an integerlist string and set each found value
* @param p the string to be parsed. Each element in the list is seperated by a

@ -7,7 +7,7 @@
#include "table/strings.h"
#include "gui.h"
#include "window_gui.h"
#include "viewport.h"
#include "viewport_func.h"
#include "news.h"
#include "variables.h"
#include "transparency.h"

@ -20,7 +20,8 @@
#include "station_map.h"
#include "town_map.h"
#include "tunnel_map.h"
#include "viewport.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "window_func.h"
#include "window_gui.h"
#include "player.h"

@ -13,7 +13,8 @@
#include "station.h"
#include "town.h"
#include "command_func.h"
#include "viewport.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "depot.h"
#include "waypoint.h"
#include "train.h"

@ -9,7 +9,8 @@
#include "gui.h"
#include "window_gui.h"
#include "textbuf_gui.h"
#include "viewport.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "player.h"
#include "command_func.h"
#include "network/network.h"

@ -16,7 +16,7 @@
#include "landscape.h"
#include "town_map.h"
#include "tunnel_map.h"
#include "viewport.h"
#include "viewport_func.h"
#include "command_func.h"
#include "pathfind.h"
#include "engine.h"

@ -12,7 +12,8 @@
#include "window_gui.h"
#include "station_gui.h"
#include "terraform_gui.h"
#include "viewport.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "command_func.h"
#include "station.h"
#include "waypoint.h"

@ -16,7 +16,7 @@
#include "tile_cmd.h"
#include "landscape.h"
#include "town_map.h"
#include "viewport.h"
#include "viewport_func.h"
#include "command_func.h"
#include "player.h"
#include "town.h"

@ -10,7 +10,8 @@
#include "window_gui.h"
#include "station_gui.h"
#include "terraform_gui.h"
#include "viewport.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "command_func.h"
#include "variables.h"
#include "road_type.h"

@ -40,6 +40,7 @@
#include "sound_func.h"
#include "variables.h"
#include "autoreplace_gui.h"
#include "gfx_func.h"
static const uint16 _roadveh_images[63] = {

@ -10,7 +10,8 @@
#include "table/strings.h"
#include "gui.h"
#include "window_gui.h"
#include "viewport.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "command_func.h"
#include "depot.h"
#include "vehicle_gui.h"

@ -25,6 +25,7 @@
#include "vehicle_base.h"
#include "core/alloc_func.hpp"
#include "string_func.h"
#include "gfx_func.h"
static uint32 _difficulty_click_a;
static uint32 _difficulty_click_b;

@ -36,6 +36,7 @@
#include "sound_func.h"
#include "variables.h"
#include "autoreplace_gui.h"
#include "gfx_func.h"
static const uint16 _ship_sprites[] = {0x0E5D, 0x0E55, 0x0E65, 0x0E6D};

@ -10,7 +10,8 @@
#include "table/sprites.h"
#include "gui.h"
#include "window_gui.h"
#include "viewport.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "depot.h"
#include "vehicle_gui.h"
#include "newgrf_engine.h"

@ -18,6 +18,8 @@
#include "core/alloc_func.hpp"
#include "window_func.h"
#include "map_func.h"
#include "gfx_func.h"
#include "viewport_func.h"
static const Sign **_sign_sort;
static uint _num_sign_sort;

@ -16,7 +16,8 @@
#include "window_gui.h"
#include "tree_map.h"
#include "tunnel_map.h"
#include "viewport.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "player.h"
#include "town.h"
#include "variables.h"

@ -7,7 +7,6 @@
#include "landscape.h"
#include "mixer.h"
#include "sound_func.h"
#include "viewport.h"
#include "fileio.h"
#include "newgrf_sound.h"
#include "fios.h"

@ -23,6 +23,8 @@
#include "strings_func.h"
#include "core/alloc_func.hpp"
#include "window_func.h"
#include "viewport_func.h"
#include "gfx_func.h"
typedef int CDECL StationSortListingTypeFunction(const void*, const void*);

@ -15,6 +15,8 @@
#include "window_gui.h"
#include "strings_func.h"
#include "date_func.h"
#include "viewport_func.h"
#include "gfx_func.h"
static void HandleSubsidyClick(int y)
{

@ -52,21 +52,21 @@ static const int _AutorailTilehSprite[][6] = {
// maps each pixel of a tile (16x16) to a selection type
// (0,0) is the top cor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T_DIR_HL, HT_DIR_HL, HT_DIR_HL, HT_DIR_HL, HT_DIR_HL },
{ HT_DIR_VL, HT_DIR_VL, HT_DIR_VL, HT_DIR_VL, HT_DIR_VL, HT_DIR_VL, HT_DIR_X, HT_DIR_X, HT_DIR_X, HT_DIR_X, HT_DIR_HL, HT_DIR_HL, HT_DIR_HL, HT_DIR_HL, HT_DIR_HL, HT_DIR_HL },
{ HT_DIR_VL, HT_DIR_VL, HT_DIR_VL, HT_DIR_VL, HT_DIR_VL, HT_DIR_VL, HT_DIR_X, HT_DIR_X, HT_DIR_X, HT_DIR_X, HT_DIR_HL, HT_DIR_HL, HT_DIR_HL, HT_DIR_HL, HT_DIR_HL, HT_DIR_HL }
};

@ -11,7 +11,8 @@
#include "player.h"
#include "gui.h"
#include "window_gui.h"
#include "viewport.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "command_func.h"
#include "signs.h"
#include "variables.h"

@ -16,6 +16,7 @@
#include "strings_func.h"
#include "vehicle_base.h"
#include "string_func.h"
#include "gfx_func.h"
static int GetOrderFromTimetableWndPt(Window *w, int y, const Vehicle *v)
{

@ -13,7 +13,7 @@
#include "landscape.h"
#include "town_map.h"
#include "tunnel_map.h"
#include "viewport.h"
#include "viewport_func.h"
#include "town.h"
#include "command_func.h"
#include "industry.h"

@ -8,7 +8,8 @@
#include "table/sprites.h"
#include "table/strings.h"
#include "town.h"
#include "viewport.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "gui.h"
#include "window_gui.h"
#include "textbuf_gui.h"

@ -45,6 +45,7 @@
#include "sound_func.h"
#include "variables.h"
#include "autoreplace_gui.h"
#include "gfx_func.h"
static bool TrainCheckIfLineEnds(Vehicle *v);

@ -9,7 +9,7 @@
#include "table/strings.h"
#include "gui.h"
#include "window_gui.h"
#include "viewport.h"
#include "gfx_func.h"
#include "command_func.h"
#include "vehicle_gui.h"
#include "depot.h"

@ -6,7 +6,6 @@
#include "table/strings.h"
#include "gui.h"
#include "window_gui.h"
#include "viewport.h"
#include "variables.h"
#include "transparency.h"
#include "sound_func.h"

@ -16,7 +16,7 @@
#include "landscape.h"
#include "tunnel_map.h"
#include "unmovable_map.h"
#include "viewport.h"
#include "viewport_func.h"
#include "command_func.h"
#include "player.h"
#include "town.h"

@ -9,7 +9,7 @@
#include "tile_cmd.h"
#include "landscape.h"
#include "command_func.h"
#include "viewport.h"
#include "viewport_func.h"
#include "player.h"
#include "gui.h"
#include "station.h"

@ -13,7 +13,8 @@
#include "tile_cmd.h"
#include "landscape.h"
#include "timetable.h"
#include "viewport.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "news.h"
#include "command_func.h"
#include "saveload.h"

@ -16,7 +16,8 @@
#include "command_func.h"
#include "variables.h"
#include "vehicle_gui.h"
#include "viewport.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "train.h"
#include "newgrf_callbacks.h"
#include "newgrf_engine.h"

@ -11,7 +11,7 @@
#include "table/sprites.h"
#include "table/strings.h"
#include "landscape.h"
#include "viewport.h"
#include "viewport_func.h"
#include "station.h"
#include "town.h"
#include "signs.h"
@ -28,6 +28,8 @@
#define VIEWPORT_DRAW_MEM (65536 * 2)
PlaceProc *_place_proc;
Point _tile_fract_coords;
ZoomLevel _saved_scrollpos_zoom;
/**
@ -865,23 +867,22 @@ static bool IsPartOfAutoLine(int px, int py)
px -= _thd.selstart.x;
py -= _thd.selstart.y;
switch (_thd.drawstyle) {
case HT_LINE | HT_DIR_X: return py == 0; // x direction
case HT_LINE | HT_DIR_Y: return px == 0; // y direction
case HT_LINE | HT_DIR_HU: return px == -py || px == -py - 16; // horizontal upper
case HT_LINE | HT_DIR_HL: return px == -py || px == -py + 16; // horizontal lower
case HT_LINE | HT_DIR_VL: return px == py || px == py + 16; // vertival left
case HT_LINE | HT_DIR_VR: return px == py || px == py - 16; // vertical right
default:
NOT_REACHED();
}
if ((_thd.drawstyle & ~HT_DIR_MASK) != HT_LINE) return false;
/* useless, but avoids compiler warning this way */
return 0;
switch (_thd.drawstyle & HT_DIR_MASK) {
case HT_DIR_X: return py == 0; // x direction
case HT_DIR_Y: return px == 0; // y direction
case HT_DIR_HU: return px == -py || px == -py - 16; // horizontal upper
case HT_DIR_HL: return px == -py || px == -py + 16; // horizontal lower
case HT_DIR_VL: return px == py || px == py + 16; // vertival left
case HT_DIR_VR: return px == py || px == py - 16; // vertical right
default:
NOT_REACHED();
}
}
// [direction][side]
static const int _AutorailType[6][2] = {
static const HighLightStyle _autorail_type[6][2] = {
{ HT_DIR_X, HT_DIR_X },
{ HT_DIR_Y, HT_DIR_Y },
{ HT_DIR_HU, HT_DIR_HL },
@ -969,7 +970,7 @@ static void DrawTileSelection(const TileInfo *ti)
/* autorail highlight piece under cursor */
uint type = _thd.drawstyle & 0xF;
assert(type <= 5);
DrawAutorailSelection(ti, _AutorailType[type][0]);
DrawAutorailSelection(ti, _autorail_type[type][0]);
} else if (IsPartOfAutoLine(ti->x, ti->y)) {
/* autorail highlighting long line */
int dir = _thd.drawstyle & ~0xF0;
@ -982,7 +983,7 @@ static void DrawTileSelection(const TileInfo *ti)
side = Delta(Delta(TileX(start), TileX(ti->tile)), Delta(TileY(start), TileY(ti->tile)));
}
DrawAutorailSelection(ti, _AutorailType[dir][side]);
DrawAutorailSelection(ti, _autorail_type[dir][side]);
}
return;
}
@ -2229,9 +2230,9 @@ void SetTileSelectBigSize(int ox, int oy, int sx, int sy)
}
/** returns the best autorail highlight type from map coordinates */
static byte GetAutorailHT(int x, int y)
static HighLightStyle GetAutorailHT(int x, int y)
{
return HT_RAIL | _AutorailPiece[x & 0xF][y & 0xF];
return HT_RAIL | _autorail_piece[x & 0xF][y & 0xF];
}
/**
@ -2376,7 +2377,7 @@ static void VpStartPreSizing()
/** returns information about the 2x1 piece to be build.
* The lower bits (0-3) are the track type. */
static byte Check2x1AutoRail(int mode)
static HighLightStyle Check2x1AutoRail(int mode)
{
int fxpy = _tile_fract_coords.x + _tile_fract_coords.y;
int sxpy = (_thd.selend.x & 0xF) + (_thd.selend.y & 0xF);
@ -2384,28 +2385,27 @@ static byte Check2x1AutoRail(int mode)
int sxmy = (_thd.selend.x & 0xF) - (_thd.selend.y & 0xF);
switch (mode) {
case 0: // end piece is lower right
if (fxpy >= 20 && sxpy <= 12) { /*SwapSelection(); DoRailroadTrack(0); */return 3; }
if (fxmy < -3 && sxmy > 3) {/* DoRailroadTrack(0); */return 5; }
return 1;
default: NOT_REACHED();
case 0: // end piece is lower right
if (fxpy >= 20 && sxpy <= 12) { /*SwapSelection(); DoRailroadTrack(0); */return HT_DIR_HL; }
if (fxmy < -3 && sxmy > 3) {/* DoRailroadTrack(0); */return HT_DIR_VR; }
return HT_DIR_Y;
case 1:
if (fxmy > 3 && sxmy < -3) { /*SwapSelection(); DoRailroadTrack(0); */return 4; }
if (fxpy <= 12 && sxpy >= 20) { /*DoRailroadTrack(0); */return 2; }
return 1;
case 1:
if (fxmy > 3 && sxmy < -3) { /*SwapSelection(); DoRailroadTrack(0); */return HT_DIR_VL; }
if (fxpy <= 12 && sxpy >= 20) { /*DoRailroadTrack(0); */return HT_DIR_HU; }
return HT_DIR_Y;
case 2:
if (fxmy > 3 && sxmy < -3) { /*DoRailroadTrack(3);*/ return 4; }
if (fxpy >= 20 && sxpy <= 12) { /*SwapSelection(); DoRailroadTrack(0); */return 3; }
return 0;
case 2:
if (fxmy > 3 && sxmy < -3) { /*DoRailroadTrack(3);*/ return HT_DIR_VL; }
if (fxpy >= 20 && sxpy <= 12) { /*SwapSelection(); DoRailroadTrack(0); */return HT_DIR_HL; }
return HT_DIR_X;
case 3:
if (fxmy < -3 && sxmy > 3) { /*SwapSelection(); DoRailroadTrack(3);*/ return 5; }
if (fxpy <= 12 && sxpy >= 20) { /*DoRailroadTrack(0); */return 2; }
return 0;
case 3:
if (fxmy < -3 && sxmy > 3) { /*SwapSelection(); DoRailroadTrack(3);*/ return HT_DIR_VR; }
if (fxpy <= 12 && sxpy >= 20) { /*DoRailroadTrack(0); */return HT_DIR_HU; }
return HT_DIR_X;
}
return 0; // avoids compiler warnings
}
/** Check if the direction of start and end tile should be swapped based on
@ -2749,7 +2749,7 @@ calc_heightdiff_single_direction:;
/* If dragging an area (eg dynamite tool) and it is actually a single
* row/column, change the type to 'line' to get proper calculation for height */
style = _thd.next_drawstyle;
style = (HighLightStyle)_thd.next_drawstyle;
if (style & HT_RECT) {
if (dx == 1) {
style = HT_LINE | HT_DIR_Y;

@ -0,0 +1,80 @@
/* $Id$ */
/** @file viewport_func.h Functions related to (drawing on) viewports. */
#ifndef VIEWPORT_FUNC_H
#define VIEWPORT_FUNC_H
#include "viewport_type.h"
#include "vehicle_type.h"
void SetSelectionRed(bool);
void InitViewports();
void DeleteWindowViewport(Window *w);
void AssignWindowViewport(Window *w, int x, int y, int width, int height, uint32 follow_flags, ZoomLevel zoom);
ViewPort *IsPtInWindowViewport(const Window *w, int x, int y);
Point GetTileBelowCursor();
void UpdateViewportPosition(Window *w);
bool DoZoomInOutWindow(int how, Window *w);
void ZoomInOrOutToCursorWindow(bool in, Window * w);
Point GetTileZoomCenterWindow(bool in, Window * w);
void HandleZoomMessage(Window *w, const ViewPort *vp, byte widget_zoom_in, byte widget_zoom_out);
static inline void MaxZoomInOut(int how, Window *w)
{
while (DoZoomInOutWindow(how, w)) {};
}
void OffsetGroundSprite(int x, int y);
void DrawGroundSprite(SpriteID image, SpriteID pal, const SubSprite *sub = NULL);
void DrawGroundSpriteAt(SpriteID image, SpriteID pal, int32 x, int32 y, byte z, const SubSprite *sub = NULL);
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);
void *AddStringToDraw(int x, int y, StringID string, uint64 params_1, uint64 params_2);
void AddChildSpriteScreen(SpriteID image, SpriteID pal, int x, int y, bool transparent = false, const SubSprite *sub = NULL);
void StartSpriteCombine();
void EndSpriteCombine();
void HandleViewportClicked(const ViewPort *vp, int x, int y);
void PlaceObject();
void SetRedErrorSquare(TileIndex tile);
void SetTileSelectSize(int w, int h);
void SetTileSelectBigSize(int ox, int oy, int sx, int sy);
Vehicle *CheckMouseOverVehicle();
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method);
void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, byte process);
void VpSetPresizeRange(uint from, uint to);
void VpSetPlaceSizingLimit(int limit);
typedef void PlaceProc(TileIndex tile);
void PlaceProc_DemolishArea(TileIndex tile);
void PlaceProc_LevelLand(TileIndex tile);
void PlaceProc_BuyLand(TileIndex tile);
bool GUIPlaceProcDragXY(const WindowEvent *e);
/* common button handler */
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, ViewportHighlightMode mode, PlaceProc *placeproc);
void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom);
void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, ViewportHighlightMode mode, Window *w);
void SetObjectToPlace(CursorID icon, SpriteID pal, ViewportHighlightMode mode, WindowClass window_class, WindowNumber window_num);
void ResetObjectToPlace();
bool ScrollWindowTo(int x, int y, Window *w, bool instant = false);
bool ScrollMainWindowToTile(TileIndex tile, bool instant = false);
bool ScrollMainWindowTo(int x, int y, bool instant = false);
extern PlaceProc *_place_proc;
extern Point _tile_fract_coords;
extern TileHighlightData _thd;
#endif /* VIEWPORT_FUNC_H */

@ -1,15 +1,13 @@
/* $Id$ */
/** @file viewport.h */
/** @file viewport_type.h Types related to viewports. */
#ifndef VIEWPORT_H
#define VIEWPORT_H
#ifndef VIEWPORT_TYPE_H
#define VIEWPORT_TYPE_H
#include "zoom_type.h"
#include "window_type.h"
#include "vehicle_type.h"
#include "gfx_func.h"
#include "gui.h"
#include "tile_type.h"
struct ViewPort {
int left,top; // screen coordinates for the viewport
@ -21,33 +19,12 @@ struct ViewPort {
ZoomLevel zoom;
};
void SetSelectionRed(bool);
/* viewport.cpp */
void InitViewports();
void DeleteWindowViewport(Window *w);
void AssignWindowViewport(Window *w, int x, int y,
int width, int height, uint32 follow_flags, ZoomLevel zoom);
ViewPort *IsPtInWindowViewport(const Window *w, int x, int y);
Point GetTileBelowCursor();
void UpdateViewportPosition(Window *w);
enum {
ZOOM_IN = 0,
ZOOM_OUT = 1,
ZOOM_NONE = 2, // hack, used to update the button status
};
bool DoZoomInOutWindow(int how, Window *w);
void ZoomInOrOutToCursorWindow(bool in, Window * w);
Point GetTileZoomCenterWindow(bool in, Window * w);
void HandleZoomMessage(Window *w, const ViewPort *vp, byte widget_zoom_in, byte widget_zoom_out);
static inline void MaxZoomInOut(int how, Window *w)
{
while (DoZoomInOutWindow(how, w)) {};
}
/**
* Some values for constructing bounding boxes (BB). The Z positions under bridges are:
* z=0..5 Everything that can be built under low bridges.
@ -59,26 +36,6 @@ enum {
BB_Z_SEPARATOR = 7, ///< Separates the bridge/tunnel from the things under/above it.
};
void OffsetGroundSprite(int x, int y);
void DrawGroundSprite(SpriteID image, SpriteID pal, const SubSprite *sub = NULL);
void DrawGroundSpriteAt(SpriteID image, SpriteID pal, int32 x, int32 y, byte z, const SubSprite *sub = NULL);
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);
void *AddStringToDraw(int x, int y, StringID string, uint64 params_1, uint64 params_2);
void AddChildSpriteScreen(SpriteID image, SpriteID pal, int x, int y, bool transparent = false, const SubSprite *sub = NULL);
void StartSpriteCombine();
void EndSpriteCombine();
void HandleViewportClicked(const ViewPort *vp, int x, int y);
void PlaceObject();
void SetRedErrorSquare(TileIndex tile);
void SetTileSelectSize(int w, int h);
void SetTileSelectBigSize(int ox, int oy, int sx, int sy);
Vehicle *CheckMouseOverVehicle();
/** Viewport place method (type of highlighted area and placed objects) */
enum ViewportPlaceMethod {
VPM_X_OR_Y = 0, ///< drag in X or Y direction
@ -100,14 +57,8 @@ enum ViewportHighlightMode {
VHM_RAIL = 5, ///< rail pieces
};
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method);
void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, byte process);
void VpSetPresizeRange(uint from, uint to);
void VpSetPlaceSizingLimit(int limit);
/* highlighting draw styles */
typedef byte HighLightStyle;
enum HighLightStyles {
enum HighLightStyle {
HT_NONE = 0x00,
HT_RECT = 0x80,
HT_POINT = 0x40,
@ -127,6 +78,8 @@ enum HighLightStyles {
HT_DIR_VR = 5, ///< vertical right
HT_DIR_MASK = 0x7 ///< masks the drag-direction
};
DECLARE_ENUM_AS_BIT_SET(HighLightStyle);
struct TileHighlightData {
Point size;
@ -158,25 +111,4 @@ struct TileHighlightData {
TileIndex redsq;
};
/* common button handler */
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, ViewportHighlightMode mode, PlaceProc *placeproc);
VARDEF Point _tile_fract_coords;
extern TileHighlightData _thd;
void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom);
void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, ViewportHighlightMode mode, Window *w);
void SetObjectToPlace(CursorID icon, SpriteID pal, ViewportHighlightMode mode, WindowClass window_class, WindowNumber window_num);
void ResetObjectToPlace();
bool ScrollWindowTo(int x, int y, Window *w, bool instant = false);
bool ScrollMainWindowToTile(TileIndex tile, bool instant = false);
bool ScrollMainWindowTo(int x, int y, bool instant = false);
#endif /* VIEWPORT_H */
#endif /* VIEWPORT_TYPE_H */

@ -12,7 +12,7 @@
#include "table/strings.h"
#include "tile_cmd.h"
#include "landscape.h"
#include "viewport.h"
#include "viewport_func.h"
#include "command_func.h"
#include "town.h"
#include "news.h"

@ -7,7 +7,7 @@
#include "player.h"
#include "table/sprites.h"
#include "table/strings.h"
#include "viewport.h"
#include "gfx_func.h"
#include "window_gui.h"
#include "window_func.h"

@ -7,8 +7,9 @@
#include "openttd.h"
#include "debug.h"
#include "player.h"
#include "viewport.h"
#include "gfx_func.h"
#include "console.h"
#include "viewport_func.h"
#include "variables.h"
#include "table/sprites.h"
#include "genworld.h"

@ -7,7 +7,7 @@
#include "core/bitmath_func.hpp"
#include "vehicle_type.h"
#include "viewport.h"
#include "viewport_type.h"
/**
* The maximum number of windows that can be opened.

Loading…
Cancel
Save