(svn r11684) -Codechange: split gfx.h in a type and functional header.

pull/155/head
rubidium 17 years ago
parent a3693160cf
commit 507463e420

@ -1,8 +1,9 @@
/* $Id$ */
#include "../stdafx.h"
#include "../zoom.hpp"
#include "../gfx.h"
#include "../helpers.hpp"
#include "../gfx_func.h"
#include "../zoom_func.h"
#include "../debug.h"
#include "../table/sprites.h"
#include "../video/video_driver.hpp"

@ -1,7 +1,7 @@
/* $Id$ */
#include "../stdafx.h"
#include "../gfx.h"
#include "../gfx_func.h"
#include "32bpp_base.hpp"
void *Blitter_32bppBase::MoveTo(const void *video, int x, int y)

@ -1,8 +1,8 @@
/* $Id$ */
#include "../stdafx.h"
#include "../zoom.hpp"
#include "../gfx.h"
#include "../zoom_func.h"
#include "../gfx_func.h"
#include "../debug.h"
#include "../table/sprites.h"
#include "32bpp_optimized.hpp"

@ -1,8 +1,8 @@
/* $Id$ */
#include "../stdafx.h"
#include "../zoom.hpp"
#include "../gfx.h"
#include "../gfx_func.h"
#include "../zoom_func.h"
#include "../debug.h"
#include "../table/sprites.h"
#include "32bpp_simple.hpp"

@ -1,7 +1,7 @@
/* $Id$ */
#include "../stdafx.h"
#include "../gfx.h"
#include "../gfx_func.h"
#include "8bpp_base.hpp"
void Blitter_8bppBase::DrawColorMappingRect(void *dst, int width, int height, int pal)

@ -3,8 +3,7 @@
/** @file 8bpp_debug.cpp */
#include "../stdafx.h"
#include "../zoom.hpp"
#include "../gfx.h"
#include "../zoom_func.h"
#include "../functions.h"
#include "8bpp_debug.hpp"

@ -3,9 +3,9 @@
/** @file 8bpp_optimized.cpp */
#include "../stdafx.h"
#include "../zoom.hpp"
#include "../gfx.h"
#include "../zoom_func.h"
#include "../debug.h"
#include "../helpers.hpp"
#include "8bpp_optimized.hpp"
static FBlitter_8bppOptimized iFBlitter_8bppOptimized;

@ -3,8 +3,7 @@
/** @file 8bpp_simple.cpp */
#include "../stdafx.h"
#include "../zoom.hpp"
#include "../gfx.h"
#include "../zoom_func.h"
#include "8bpp_simple.hpp"
static FBlitter_8bppSimple iFBlitter_8bppSimple;

@ -5,7 +5,7 @@
#include "../spritecache.h"
#include "../spriteloader/spriteloader.hpp"
#include "../zoom.hpp"
#include "../zoom_type.h"
enum BlitterMode {
BM_NORMAL,

@ -4,7 +4,6 @@
#include "stdafx.h"
#include "openttd.h"
#include "gfx.h"
#include "bmp.h"
#include "core/bitmath_func.hpp"

@ -5,6 +5,8 @@
#ifndef BMP_H
#define BMP_H
#include "gfx_type.h"
struct BmpInfo {
uint32 offset; ///< offset of bitmap data from .bmp file begining
uint32 width; ///< bitmap width

@ -5,6 +5,8 @@
#ifndef BRIDGE_H
#define BRIDGE_H
#include "gfx_type.h"
enum {
MAX_BRIDGES = 13
};

@ -6,6 +6,7 @@
#define CARGOTYPE_H
#include "cargo_type.h"
#include "gfx_type.h"
typedef uint32 CargoLabel;

@ -17,6 +17,7 @@
#include "genworld.h"
#include "newgrf_storage.h"
#include "strings_func.h"
#include "gfx_func.h"
const char *_cmd_text = NULL;

@ -7,6 +7,7 @@
#include "economy_type.h"
#include "strings_type.h"
#include "tile_type.h"
/**
* Common return value for all commands. Wraps the cost and

@ -17,12 +17,6 @@
#undef abs
#endif
/**
* The largest value that can be entered in a variable
* @param type the type of the variable
*/
#define MAX_UVALUE(type) ((type)~(type)0)
/**
* Returns the maximum of two values.
*

@ -10,6 +10,7 @@
#include "cargo_type.h"
#include "vehicle_type.h"
#include "command_type.h"
#include "gfx_type.h"
#include "sound.h"
enum RailVehicleTypes {

@ -14,6 +14,7 @@
#include "helpers.hpp"
#include "spriteloader/spriteloader.hpp"
#include "blitter/factory.hpp"
#include "gfx_func.h"
#ifdef WITH_FREETYPE

@ -3,7 +3,7 @@
#ifndef FONTCACHE_H
#define FONTCACHE_H
#include "gfx.h"
#include "gfx_type.h"
/** Get the SpriteID mapped to the given font size and key */
SpriteID GetUnicodeGlyph(FontSize size, uint32 key);

@ -8,6 +8,7 @@
#include "core/random_func.hpp"
#include "command_type.h"
#include "window_type.h"
#include "openttd.h"
void UpdateTownMaxPass(Town *t);

@ -5,7 +5,7 @@
#include "stdafx.h"
#include "openttd.h"
#include "functions.h"
#include "gfx.h"
#include "gfx_func.h"
#include "spritecache.h"
#include "string.h"
#include "table/palettes.h"
@ -15,7 +15,7 @@
#include "fontcache.h"
#include "genworld.h"
#include "debug.h"
#include "zoom.hpp"
#include "zoom_func.h"
#include "texteff.hpp"
#include "blitter/factory.hpp"
#include "video/video_driver.hpp"
@ -41,6 +41,9 @@ int _pal_count_dirty;
Colour _cur_palette[256];
byte _stringwidth_table[FS_END][224];
DrawPixelInfo *_cur_dpi;
byte _colour_gradient[16][8];
bool _use_dos_palette;
static void GfxMainBlitter(const Sprite *sprite, int x, int y, BlitterMode mode, const SubSprite *sub = NULL);
@ -561,7 +564,7 @@ Dimension GetStringBoundingBox(const char *str)
* @param x offset from left side of the screen, if negative offset from the right side
* @param y offset from top side of the screen, if negative offset from the bottom
* @param real_color colour of the string, see _string_colormap in
* table/palettes.h or docs/ottd-colourtext-palette.png or the enum TextColour in gfx.h
* table/palettes.h or docs/ottd-colourtext-palette.png or the enum TextColour in gfx_type.h
* @return the x-coordinates where the drawing has finished. If nothing is drawn
* the originally passed x-coordinate is returned */
int DoDrawString(const char *string, int x, int y, uint16 real_color)

@ -1,6 +1,6 @@
/* $Id$ */
/** @file gfx.h */
/** @file gfx_func.h Functions related to the gfx engine. */
/**
* @defgroup dirty Dirty
@ -32,150 +32,16 @@
*/
#ifndef GFX_H
#define GFX_H
#include "openttd.h"
#include "core/math_func.hpp"
#include "core/geometry_type.hpp"
#include "core/enum_type.hpp"
#include "zoom.hpp"
enum WindowKeyCodes {
WKC_SHIFT = 0x8000,
WKC_CTRL = 0x4000,
WKC_ALT = 0x2000,
WKC_META = 0x1000,
/* Special ones */
WKC_NONE = 0,
WKC_ESC = 1,
WKC_BACKSPACE = 2,
WKC_INSERT = 3,
WKC_DELETE = 4,
WKC_PAGEUP = 5,
WKC_PAGEDOWN = 6,
WKC_END = 7,
WKC_HOME = 8,
/* Arrow keys */
WKC_LEFT = 9,
WKC_UP = 10,
WKC_RIGHT = 11,
WKC_DOWN = 12,
/* Return & tab */
WKC_RETURN = 13,
WKC_TAB = 14,
/* Space */
WKC_SPACE = 32,
/* Function keys */
WKC_F1 = 33,
WKC_F2 = 34,
WKC_F3 = 35,
WKC_F4 = 36,
WKC_F5 = 37,
WKC_F6 = 38,
WKC_F7 = 39,
WKC_F8 = 40,
WKC_F9 = 41,
WKC_F10 = 42,
WKC_F11 = 43,
WKC_F12 = 44,
/* Backquote is the key left of "1"
* we only store this key here, no matter what character is really mapped to it
* on a particular keyboard. (US keyboard: ` and ~ ; German keyboard: ^ and °) */
WKC_BACKQUOTE = 45,
WKC_PAUSE = 46,
/* 0-9 are mapped to 48-57
* A-Z are mapped to 65-90
* a-z are mapped to 97-122 */
/* Numerical keyboard */
WKC_NUM_0 = 128,
WKC_NUM_1 = 129,
WKC_NUM_2 = 130,
WKC_NUM_3 = 131,
WKC_NUM_4 = 132,
WKC_NUM_5 = 133,
WKC_NUM_6 = 134,
WKC_NUM_7 = 135,
WKC_NUM_8 = 136,
WKC_NUM_9 = 137,
WKC_NUM_DIV = 138,
WKC_NUM_MUL = 139,
WKC_NUM_MINUS = 140,
WKC_NUM_PLUS = 141,
WKC_NUM_ENTER = 142,
WKC_NUM_DECIMAL = 143,
/* Other keys */
WKC_SLASH = 144, ///< / Forward slash
WKC_SEMICOLON = 145, ///< ; Semicolon
WKC_EQUALS = 146, ///< = Equals
WKC_L_BRACKET = 147, ///< [ Left square bracket
WKC_BACKSLASH = 148, ///< \ Backslash
WKC_R_BRACKET = 149, ///< ] Right square bracket
WKC_SINGLEQUOTE = 150, ///< ' Single quote
WKC_COMMA = 151, ///< , Comma
WKC_PERIOD = 152, ///< . Period
WKC_MINUS = 153, ///< - Minus
};
#ifndef GFX_FUNC_H
#define GFX_FUNC_H
#include "gfx_type.h"
#include "strings_type.h"
void GameLoop();
void CreateConsole();
/** A single sprite of a list of animated cursors */
struct AnimCursor {
static const CursorID LAST = MAX_UVALUE(CursorID);
CursorID sprite; ///< Must be set to LAST_ANIM when it is the last sprite of the loop
byte display_time; ///< Amount of ticks this sprite will be shown
};
struct CursorVars {
Point pos, size, offs, delta; ///< position, size, offset from top-left, and movement
Point draw_pos, draw_size; ///< position and size bounding-box for drawing
SpriteID sprite; ///< current image of cursor
SpriteID pal;
int wheel; ///< mouse wheel movement
/* We need two different vars to keep track of how far the scrollwheel moved.
* OSX uses this for scrolling around the map. */
int v_wheel;
int h_wheel;
const AnimCursor *animate_list; ///< in case of animated cursor, list of frames
const AnimCursor *animate_cur; ///< in case of animated cursor, current frame
uint animate_timeout; ///< in case of animated cursor, number of ticks to show the current cursor
bool visible; ///< cursor is visible
bool dirty; ///< the rect occupied by the mouse is dirty (redraw)
bool fix_at; ///< mouse is moving, but cursor is not (used for scrolling)
bool in_window; ///< mouse inside this window, determines drawing logic
};
struct DrawPixelInfo {
void *dst_ptr;
int left, top, width, height;
int pitch;
ZoomLevel zoom;
};
struct Colour {
byte r;
byte g;
byte b;
};
extern byte _dirkeys; ///< 1 = left, 2 = up, 4 = right, 8 = down
extern bool _fullscreen;
extern CursorVars _cursor;
@ -211,26 +77,9 @@ void HandleExitGameRequest();
void GameSizeChanged();
void UndrawMouseCursor();
enum FontSize {
FS_NORMAL,
FS_SMALL,
FS_LARGE,
FS_END,
};
DECLARE_POSTFIX_INCREMENT(FontSize);
void RedrawScreenRect(int left, int top, int right, int bottom);
void GfxScroll(int left, int top, int width, int height, int xo, int yo);
/**
* Used to only draw a part of the sprite.
* Draw the subsprite in the rect (sprite_x_offset + left, sprite_y_offset + top) to (sprite_x_offset + right, sprite_y_offset + bottom).
* Both corners are included in the drawing area.
*/
struct SubSprite {
int left, top, right, bottom;
};
void DrawSprite(SpriteID img, SpriteID pal, int x, int y, const SubSprite *sub = NULL);
/* XXX doesn't really belong here, but the only
@ -320,59 +169,14 @@ static inline byte GetCharacterHeight(FontSize size)
}
}
VARDEF DrawPixelInfo *_cur_dpi;
enum {
COLOUR_DARK_BLUE,
COLOUR_PALE_GREEN,
COLOUR_PINK,
COLOUR_YELLOW,
COLOUR_RED,
COLOUR_LIGHT_BLUE,
COLOUR_GREEN,
COLOUR_DARK_GREEN,
COLOUR_BLUE,
COLOUR_CREAM,
COLOUR_MAUVE,
COLOUR_PURPLE,
COLOUR_ORANGE,
COLOUR_BROWN,
COLOUR_GREY,
COLOUR_WHITE
};
/** Colour of the strings, see _string_colormap in table/palettes.h or docs/ottd-colourtext-palette.png */
enum TextColour {
TC_FROMSTRING = 0x00,
TC_BLUE = 0x00,
TC_SILVER = 0x01,
TC_GOLD = 0x02,
TC_RED = 0x03,
TC_PURPLE = 0x04,
TC_LIGHT_BROWN = 0x05,
TC_ORANGE = 0x06,
TC_GREEN = 0x07,
TC_YELLOW = 0x08,
TC_DARK_GREEN = 0x09,
TC_CREAM = 0x0A,
TC_BROWN = 0x0B,
TC_WHITE = 0x0C,
TC_LIGHT_BLUE = 0x0D,
TC_GREY = 0x0E,
TC_DARK_BLUE = 0x0F,
TC_BLACK = 0x10,
};
extern DrawPixelInfo *_cur_dpi;
/**
* All 16 colour gradients
* 8 colours per gradient from darkest (0) to lightest (7)
*/
VARDEF byte _colour_gradient[16][8];
VARDEF bool _use_dos_palette;
extern byte _colour_gradient[16][8];
enum StringColorFlags {
IS_PALETTE_COLOR = 0x100, ///< color value is already a real palette color index, not an index of a StringColor
};
extern bool _use_dos_palette;
#endif /* GFX_H */
#endif /* GFX_FUNC_H */

@ -0,0 +1,210 @@
/* $Id$ */
/** @file gfx_type.h Types related to the graphics and/or input devices. */
#ifndef GFX_TYPE_H
#define GFX_TYPE_H
#include "core/enum_type.hpp"
#include "core/geometry_type.hpp"
#include "zoom_type.h"
typedef uint32 SpriteID; ///< The number of a sprite, without mapping bits and colortables
struct PalSpriteID {
SpriteID sprite;
SpriteID pal;
};
typedef int32 CursorID;
enum WindowKeyCodes {
WKC_SHIFT = 0x8000,
WKC_CTRL = 0x4000,
WKC_ALT = 0x2000,
WKC_META = 0x1000,
/* Special ones */
WKC_NONE = 0,
WKC_ESC = 1,
WKC_BACKSPACE = 2,
WKC_INSERT = 3,
WKC_DELETE = 4,
WKC_PAGEUP = 5,
WKC_PAGEDOWN = 6,
WKC_END = 7,
WKC_HOME = 8,
/* Arrow keys */
WKC_LEFT = 9,
WKC_UP = 10,
WKC_RIGHT = 11,
WKC_DOWN = 12,
/* Return & tab */
WKC_RETURN = 13,
WKC_TAB = 14,
/* Space */
WKC_SPACE = 32,
/* Function keys */
WKC_F1 = 33,
WKC_F2 = 34,
WKC_F3 = 35,
WKC_F4 = 36,
WKC_F5 = 37,
WKC_F6 = 38,
WKC_F7 = 39,
WKC_F8 = 40,
WKC_F9 = 41,
WKC_F10 = 42,
WKC_F11 = 43,
WKC_F12 = 44,
/* Backquote is the key left of "1"
* we only store this key here, no matter what character is really mapped to it
* on a particular keyboard. (US keyboard: ` and ~ ; German keyboard: ^ and °) */
WKC_BACKQUOTE = 45,
WKC_PAUSE = 46,
/* 0-9 are mapped to 48-57
* A-Z are mapped to 65-90
* a-z are mapped to 97-122 */
/* Numerical keyboard */
WKC_NUM_0 = 128,
WKC_NUM_1 = 129,
WKC_NUM_2 = 130,
WKC_NUM_3 = 131,
WKC_NUM_4 = 132,
WKC_NUM_5 = 133,
WKC_NUM_6 = 134,
WKC_NUM_7 = 135,
WKC_NUM_8 = 136,
WKC_NUM_9 = 137,
WKC_NUM_DIV = 138,
WKC_NUM_MUL = 139,
WKC_NUM_MINUS = 140,
WKC_NUM_PLUS = 141,
WKC_NUM_ENTER = 142,
WKC_NUM_DECIMAL = 143,
/* Other keys */
WKC_SLASH = 144, ///< / Forward slash
WKC_SEMICOLON = 145, ///< ; Semicolon
WKC_EQUALS = 146, ///< = Equals
WKC_L_BRACKET = 147, ///< [ Left square bracket
WKC_BACKSLASH = 148, ///< \ Backslash
WKC_R_BRACKET = 149, ///< ] Right square bracket
WKC_SINGLEQUOTE = 150, ///< ' Single quote
WKC_COMMA = 151, ///< , Comma
WKC_PERIOD = 152, ///< . Period
WKC_MINUS = 153, ///< - Minus
};
/** A single sprite of a list of animated cursors */
struct AnimCursor {
static const CursorID LAST = MAX_UVALUE(CursorID);
CursorID sprite; ///< Must be set to LAST_ANIM when it is the last sprite of the loop
byte display_time; ///< Amount of ticks this sprite will be shown
};
struct CursorVars {
Point pos, size, offs, delta; ///< position, size, offset from top-left, and movement
Point draw_pos, draw_size; ///< position and size bounding-box for drawing
SpriteID sprite; ///< current image of cursor
SpriteID pal;
int wheel; ///< mouse wheel movement
/* We need two different vars to keep track of how far the scrollwheel moved.
* OSX uses this for scrolling around the map. */
int v_wheel;
int h_wheel;
const AnimCursor *animate_list; ///< in case of animated cursor, list of frames
const AnimCursor *animate_cur; ///< in case of animated cursor, current frame
uint animate_timeout; ///< in case of animated cursor, number of ticks to show the current cursor
bool visible; ///< cursor is visible
bool dirty; ///< the rect occupied by the mouse is dirty (redraw)
bool fix_at; ///< mouse is moving, but cursor is not (used for scrolling)
bool in_window; ///< mouse inside this window, determines drawing logic
};
struct DrawPixelInfo {
void *dst_ptr;
int left, top, width, height;
int pitch;
ZoomLevel zoom;
};
struct Colour {
byte r;
byte g;
byte b;
};
enum FontSize {
FS_NORMAL,
FS_SMALL,
FS_LARGE,
FS_END,
};
DECLARE_POSTFIX_INCREMENT(FontSize);
/**
* Used to only draw a part of the sprite.
* Draw the subsprite in the rect (sprite_x_offset + left, sprite_y_offset + top) to (sprite_x_offset + right, sprite_y_offset + bottom).
* Both corners are included in the drawing area.
*/
struct SubSprite {
int left, top, right, bottom;
};
enum {
COLOUR_DARK_BLUE,
COLOUR_PALE_GREEN,
COLOUR_PINK,
COLOUR_YELLOW,
COLOUR_RED,
COLOUR_LIGHT_BLUE,
COLOUR_GREEN,
COLOUR_DARK_GREEN,
COLOUR_BLUE,
COLOUR_CREAM,
COLOUR_MAUVE,
COLOUR_PURPLE,
COLOUR_ORANGE,
COLOUR_BROWN,
COLOUR_GREY,
COLOUR_WHITE
};
/** Colour of the strings, see _string_colormap in table/palettes.h or docs/ottd-colourtext-palette.png */
enum TextColour {
TC_FROMSTRING = 0x00,
TC_BLUE = 0x00,
TC_SILVER = 0x01,
TC_GOLD = 0x02,
TC_RED = 0x03,
TC_PURPLE = 0x04,
TC_LIGHT_BROWN = 0x05,
TC_ORANGE = 0x06,
TC_GREEN = 0x07,
TC_YELLOW = 0x08,
TC_DARK_GREEN = 0x09,
TC_CREAM = 0x0A,
TC_BROWN = 0x0B,
TC_WHITE = 0x0C,
TC_LIGHT_BLUE = 0x0D,
TC_GREY = 0x0E,
TC_DARK_BLUE = 0x0F,
TC_BLACK = 0x10,
};
enum StringColorFlags {
IS_PALETTE_COLOR = 0x100, ///< color value is already a real palette color index, not an index of a StringColor
};
#endif /* GFX_TYPE_H */

@ -16,6 +16,7 @@
#include "md5.h"
#include "variables.h"
#include "fontcache.h"
#include "gfx_func.h"
#include <string.h>
struct MD5File {

@ -5,6 +5,8 @@
#ifndef GFXINIT_H
#define GFXINIT_H
#include "gfx_type.h"
void CheckExternalFiles();
void GfxLoadSprites();
void LoadSpritesIndexed(int file_index, uint *sprite_id, const SpriteID *index_tbl);

@ -8,7 +8,7 @@
#include "string.h"
#include "window_type.h"
#include "vehicle_type.h"
#include "gfx.h"
#include "gfx_type.h"
/* main_gui.cpp */
void CcPlaySound10(bool success, TileIndex tile, uint32 p1, uint32 p2);

@ -15,6 +15,7 @@
#include "saveload.h"
#include "bmp.h"
#include "helpers.hpp"
#include "gfx_func.h"
/**
* Convert RGB colors to Grayscale using 29.9% Red, 58.7% Green, 11.4% Blue

@ -50,6 +50,7 @@
#include "industry.h"
#include "transparency.h"
#include "strings_func.h"
#include "zoom_func.h"
static int _rename_id = 1;
static int _rename_what = -1;

@ -25,6 +25,7 @@
#include "group.h"
#include "viewport.h"
#include "economy_func.h"
#include "zoom_func.h"
char _name_array[512][32];

@ -2,6 +2,7 @@
/** @file dbg_helpers.cpp */
#include "../stdafx.h"
#include "../openttd.h"
#include "../direction_type.h"
#include "../rail.h"
#include "../rail_map.h"

@ -19,6 +19,7 @@
#include "player_face.h"
#include "strings_func.h"
#include "vehicle.h"
#include "gfx_func.h"
/** Change the player's face.
* @param tile unused

@ -40,6 +40,7 @@
#include "fileio.h"
#include "fios.h"
#include "tile_cmd.h"
#include "zoom_func.h"
/* Variables to display file lists */
FiosItem *_fios_list;

@ -19,7 +19,6 @@
#include "../gui.h"
#include "../window_gui.h"
#include "../textbuf_gui.h"
#include "../gfx.h"
#include "../variables.h"
#include "network_server.h"
#include "network_udp.h"

@ -47,6 +47,7 @@
#include "fios.h"
#include "rail.h"
#include "strings_func.h"
#include "gfx_func.h"
/* TTDPatch extended GRF format codec
* (c) Petr Baudis 2004 (GPL'd)

@ -23,7 +23,7 @@
#include "cargotype.h"
#include "town_map.h"
#include "newgrf_town.h"
#include "gfx.h"
#include "gfx_func.h"
static StationClass station_classes[STAT_CLASS_MAX];

@ -24,7 +24,7 @@
#include "newgrf_config.h"
#include "ai/ai.h"
#include "date.h"
#include "zoom.hpp"
#include "zoom_func.h"
enum {
HEADER_SIZE = 49,

@ -64,6 +64,7 @@
#include "music/music_driver.hpp"
#include "video/video_driver.hpp"
#include "strings_func.h"
#include "zoom_func.h"
#include "bridge_map.h"
#include "clear_map.h"

@ -26,12 +26,6 @@ struct DrawPixelInfo;
struct Group;
typedef byte VehicleOrderID; ///< The index of an order within its current vehicle (not pool related)
typedef byte LandscapeID;
typedef uint32 SpriteID; ///< The number of a sprite, without mapping bits and colortables
struct PalSpriteID {
SpriteID sprite;
SpriteID pal;
};
typedef int32 CursorID;
typedef uint16 EngineID;
typedef uint16 UnitID;

@ -5,7 +5,7 @@
#include "../../variables.h"
#include "../../debug.h"
#include "../../functions.h"
#include "../../gfx.h"
#include "../../gfx_func.h"
#include "../../fileio.h"
#include "../../blitter/factory.hpp"

@ -29,7 +29,7 @@
#include "window_func.h"
#include "tile_map.h"
#include "strings_func.h"
#include "gfx.h"
#include "gfx_func.h"
/**
* Sets the local player and updates the patch settings that are set on a

@ -8,9 +8,10 @@
#include "rail_type.h"
#include "track_type.h"
#include "vehicle_type.h"
#include "gfx_type.h"
#include "core/bitmath_func.hpp"
#include "variables.h"
#include "economy_func.h"
#include "variables.h"
/** This struct contains all the info that is needed to draw and construct tracks.
*/

@ -28,6 +28,7 @@
#include "table/strings.h"
#include "window_func.h"
#include "strings_func.h"
#include "gfx_func.h"
#include <list>
extern const uint16 SAVEGAME_VERSION = 83;

@ -16,6 +16,7 @@
#include "blitter/factory.hpp"
#include "fileio.h"
#include "strings_func.h"
#include "zoom_func.h"
char _screenshot_format_name[8];
uint _num_screenshot_formats;

@ -16,6 +16,7 @@
#include "misc/autoptr.hpp"
#include "strings_func.h"
#include "viewport.h"
#include "zoom_func.h"
SignID _new_sign_id;
uint _total_signs;

@ -27,6 +27,7 @@
#include "blitter/factory.hpp"
#include "tunnelbridge_map.h"
#include "strings_func.h"
#include "zoom_func.h"
static const Widget _smallmap_widgets[] = {

@ -5,6 +5,8 @@
#ifndef SPRITE_H
#define SPRITE_H
#include "gfx_type.h"
#define GENERAL_SPRITE_COLOR(color) ((color) + PALETTE_RECOLOR_START)
#define PLAYER_SPRITE_COLOR(owner) (GENERAL_SPRITE_COLOR(_player_colors[owner]))

@ -5,6 +5,8 @@
#ifndef SPRITECACHE_H
#define SPRITECACHE_H
#include "gfx_type.h"
struct Sprite {
byte height;
uint16 width;

@ -3,7 +3,7 @@
/** @file grf.cpp */
#include "../stdafx.h"
#include "../gfx.h"
#include "../gfx_func.h"
#include "../fileio.h"
#include "../debug.h"
#include "grf.hpp"

@ -5,7 +5,7 @@
#ifdef WITH_PNG
#include "../stdafx.h"
#include "../gfx.h"
#include "../gfx_func.h"
#include "../fileio.h"
#include "../variables.h"
#include "../debug.h"

@ -32,6 +32,7 @@
#include "cargotype.h"
#include "roadveh.h"
#include "station_gui.h"
#include "zoom_func.h"
Station::Station(TileIndex tile)
{

@ -374,4 +374,10 @@ assert_compile(sizeof(uint8) == 1);
#define MAX_PATH 260
#endif
/**
* The largest value that can be entered in a variable
* @param type the type of the variable
*/
#define MAX_UVALUE(type) ((type)~(type)0)
#endif /* STDAFX_H */

@ -32,6 +32,8 @@
* @todo Split the "Sprites" enum into smaller chunks and document them
*/
#include "../gfx_type.h"
enum Sprites {
SPR_SELECT_TILE = 752,
SPR_DOT = 774, // corner marker for lower/raise land

@ -5,6 +5,8 @@
#ifndef TRANSPARENCY_H
#define TRANSPARENCY_H
#include "gfx_func.h"
/**
* Transparency option bits: which position in _transparency_opt stands for which transparency.
* If you change the order, change the order of the ShowTransparencyToolbar() stuff in transparency_gui.cpp too.

@ -42,6 +42,7 @@
#include "group.h"
#include "order.h"
#include "strings_func.h"
#include "zoom_func.h"
#define INVALID_COORD (0x7fffffff)
#define GEN_HASH(x, y) ((GB((y), 6, 6) << 6) + GB((x), 7, 6))

@ -6,16 +6,17 @@
#define VEHICLE_H
#include "vehicle_type.h"
#include "oldpool.h"
#include "order.h"
#include "track_type.h"
#include "rail_type.h"
#include "road_type.h"
#include "cargo_type.h"
#include "window_type.h"
#include "gfx_type.h"
#include "command_type.h"
#include "oldpool.h"
#include "order.h"
#include "cargopacket.h"
#include "texteff.hpp"
#include "command_type.h"
/** Road vehicle states */
enum RoadVehicleStates {

@ -7,7 +7,7 @@
#include "../openttd.h"
#include "../debug.h"
#include "../functions.h"
#include "../gfx.h"
#include "../gfx_func.h"
#include "../network/network.h"
#include "../console.h"
#include "../variables.h"

@ -2,7 +2,7 @@
#include "../stdafx.h"
#include "../openttd.h"
#include "../gfx.h"
#include "../gfx_func.h"
#include "../variables.h"
#include "../debug.h"
#include "../blitter/factory.hpp"

@ -7,7 +7,7 @@
#include "../openttd.h"
#include "../debug.h"
#include "../functions.h"
#include "../gfx.h"
#include "../gfx_func.h"
#include "../sdl.h"
#include "../variables.h"
#include "../blitter/factory.hpp"

@ -3,7 +3,7 @@
#include "../stdafx.h"
#include "../openttd.h"
#include "../functions.h"
#include "../gfx.h"
#include "../gfx_func.h"
#include "../variables.h"
#include "../win32.h"
#include "../blitter/factory.hpp"

@ -25,6 +25,7 @@
#include "blitter/factory.hpp"
#include "transparency.h"
#include "strings_func.h"
#include "zoom_func.h"
#define VIEWPORT_DRAW_MEM (65536 * 2)

@ -5,10 +5,10 @@
#ifndef VIEWPORT_H
#define VIEWPORT_H
#include "zoom.hpp"
#include "zoom_type.h"
#include "window_type.h"
#include "vehicle_type.h"
#include "gfx.h"
#include "gfx_func.h"
struct ViewPort {
int left,top; // screen coordinates for the viewport

@ -17,6 +17,7 @@
#include "helpers.hpp"
#include "blitter/factory.hpp"
#include "window_gui.h"
#include "zoom_func.h"
/* delta between mouse cursor and upper left corner of dragged window */
static Point _drag_delta;

@ -2,41 +2,13 @@
/** @file zoom.hpp */
#ifndef ZOOM_HPP
#define ZOOM_HPP
#ifndef ZOOM_FUNC_H
#define ZOOM_FUNC_H
#include "core/enum_type.hpp"
enum ZoomLevel {
/* Our possible zoom-levels */
ZOOM_LVL_BEGIN = 0,
ZOOM_LVL_NORMAL = 0,
ZOOM_LVL_OUT_2X,
ZOOM_LVL_OUT_4X,
ZOOM_LVL_OUT_8X,
ZOOM_LVL_END,
/* Here we define in which zoom viewports are */
ZOOM_LVL_VIEWPORT = ZOOM_LVL_NORMAL,
ZOOM_LVL_NEWS = ZOOM_LVL_NORMAL,
ZOOM_LVL_INDUSTRY = ZOOM_LVL_OUT_2X,
ZOOM_LVL_TOWN = ZOOM_LVL_OUT_2X,
ZOOM_LVL_AIRCRAFT = ZOOM_LVL_NORMAL,
ZOOM_LVL_SHIP = ZOOM_LVL_NORMAL,
ZOOM_LVL_TRAIN = ZOOM_LVL_NORMAL,
ZOOM_LVL_ROADVEH = ZOOM_LVL_NORMAL,
ZOOM_LVL_WORLD_SCREENSHOT = ZOOM_LVL_NORMAL,
ZOOM_LVL_DETAIL = ZOOM_LVL_OUT_2X, ///< All zoomlevels below or equal to this, will result in details on the screen, like road-work, ...
ZOOM_LVL_MIN = ZOOM_LVL_NORMAL,
ZOOM_LVL_MAX = ZOOM_LVL_OUT_8X,
};
#include "zoom_type.h"
extern ZoomLevel _saved_scrollpos_zoom;
DECLARE_POSTFIX_INCREMENT(ZoomLevel)
/**
* Scale by zoom level, usually shift left (when zoom > ZOOM_LVL_NORMAL)
* When shifting right, value is rounded up
@ -91,4 +63,4 @@ static inline int UnScaleByZoomLower(int value, ZoomLevel zoom)
return (zoom > ZOOM_LVL_NORMAL) ? value >> izoom : value << -izoom;
}
#endif /* ZOOM_HPP */
#endif /* ZOOM_FUNC_H */

@ -0,0 +1,37 @@
/* $Id$ */
/** @file zoom_type.h Types related to zooming in and out. */
#ifndef ZOOM_TYPE_H
#define ZOOM_TYPE_H
#include "core/enum_type.hpp"
enum ZoomLevel {
/* Our possible zoom-levels */
ZOOM_LVL_BEGIN = 0,
ZOOM_LVL_NORMAL = 0,
ZOOM_LVL_OUT_2X,
ZOOM_LVL_OUT_4X,
ZOOM_LVL_OUT_8X,
ZOOM_LVL_END,
/* Here we define in which zoom viewports are */
ZOOM_LVL_VIEWPORT = ZOOM_LVL_NORMAL,
ZOOM_LVL_NEWS = ZOOM_LVL_NORMAL,
ZOOM_LVL_INDUSTRY = ZOOM_LVL_OUT_2X,
ZOOM_LVL_TOWN = ZOOM_LVL_OUT_2X,
ZOOM_LVL_AIRCRAFT = ZOOM_LVL_NORMAL,
ZOOM_LVL_SHIP = ZOOM_LVL_NORMAL,
ZOOM_LVL_TRAIN = ZOOM_LVL_NORMAL,
ZOOM_LVL_ROADVEH = ZOOM_LVL_NORMAL,
ZOOM_LVL_WORLD_SCREENSHOT = ZOOM_LVL_NORMAL,
ZOOM_LVL_DETAIL = ZOOM_LVL_OUT_2X, ///< All zoomlevels below or equal to this, will result in details on the screen, like road-work, ...
ZOOM_LVL_MIN = ZOOM_LVL_NORMAL,
ZOOM_LVL_MAX = ZOOM_LVL_OUT_8X,
};
DECLARE_POSTFIX_INCREMENT(ZoomLevel)
#endif /* ZOOM_TYPE_H */
Loading…
Cancel
Save