Definition in file draw_map.h.
#include "globals.h"
Go to the source code of this file.
Data Structures | |
struct | PALETTE_ENTRY |
struct | MAPDRAW_DATA |
Defines | |
#define | ERR_DRAW_BADTXTR -33 |
#define | ERR_DRAW_BADCUBE -34 |
#define | SIN_ACOS_SIZE 1024 |
Enumerations | |
enum | BMFONT_OPTIONS { BMFONT_DONT_LOAD = 0x00, BMFONT_LOAD_SMALL = 0x01, BMFONT_LOAD_LARGE = 0x02 } |
enum | TNGFLG_OPTIONS { TNGFLG_NONE = 0x00, TNGFLG_SHOW_CIRCLES = 0x01 } |
Functions | |
DLLIMPORT short | generate_map_bitmap (const char *bmpfname, const struct LEVEL *lvl, const struct MAPDRAW_OPTIONS *opts) |
Generates bitmap representing the current map layout. | |
DLLIMPORT short | generate_map_bitmap_mapfname (struct LEVEL *lvl) |
Generates bitmap representing the current map layout. | |
DLLIMPORT short | load_draw_data (struct MAPDRAW_DATA **draw_data, const struct MAPDRAW_OPTIONS *opts, const struct UPOINT_2D *subtl, const struct IPOINT_2D bmp_size, int textr_idx) |
Allocates and fills the MAPDRAW_DATA structure. | |
DLLIMPORT short | free_draw_data (struct MAPDRAW_DATA *draw_data) |
Frees the MAPDRAW_DATA structure. | |
DLLIMPORT short | draw_map_on_buffer (char *dest, const struct LEVEL *lvl, struct MAPDRAW_DATA *draw_datam, unsigned int anim) |
Draws given LEVEL on given buffer, using graphics and options from MAPDRAW_DATA. | |
DLLIMPORT short | draw_map_on_buffer_fast (char *dest, const struct LEVEL *lvl, struct MAPDRAW_DATA *draw_data, unsigned int anim) |
Draws given LEVEL on given buffer, using graphics and options from MAPDRAW_DATA. | |
DLLIMPORT short | draw_things_on_buffer (char *dest, const struct LEVEL *lvl, struct MAPDRAW_DATA *draw_data) |
Draws things from given LEVEL on given buffer, using graphics and options from MAPDRAW_DATA. | |
DLLIMPORT short | draw_text_on_buffer (char *dest, const int px, const int py, const char *text, struct MAPDRAW_DATA *draw_data, short font) |
Draws text on given buffer, using graphics and options from MAPDRAW_DATA. | |
DLLIMPORT short | change_draw_data_texture (struct MAPDRAW_DATA *draw_data, const struct MAPDRAW_OPTIONS *opts, const int textr_idx) |
Changes loaded texture in the MAPDRAW_DATA structure. | |
DLLIMPORT short | set_draw_data_rect (struct MAPDRAW_DATA *draw_data, const int startx, const int starty, const int endx, const int endy, const unsigned int scanline, const short rescale) |
Sets the drawing rectangle in MAPDRAW_DATA structure. | |
short | set_draw_data_rect_ip (struct MAPDRAW_DATA *draw_data, const struct IPOINT_2D start, const struct IPOINT_2D end, const unsigned int scanline, const short rescale) |
Sets the drawing rectangle in MAPDRAW_DATA structure. | |
short | set_draw_data_rect_sl4 (struct MAPDRAW_DATA *draw_data, const int startx, const int starty, const int endx, const int endy, const short dest_sizex, const short rescale) |
Sets the drawing rectangle in MAPDRAW_DATA structure. | |
DLLIMPORT short | get_draw_tile_rect (struct IPOINT_2D *tstart, struct IPOINT_2D *tdim, const struct MAPDRAW_DATA *draw_data, unsigned int tx, unsigned int ty) |
Returns coordinates of a graphics buffer rectangle where specific tile is. | |
DLLIMPORT short | get_draw_subtile_rect (struct IPOINT_2D *sstart, struct IPOINT_2D *sdim, const struct MAPDRAW_DATA *draw_data, unsigned int sx, unsigned int sy) |
Returns coordinates of a graphics buffer rectangle where specific subtile is. | |
DLLIMPORT short | get_subtile_from_draw_coords (unsigned int *sx, unsigned int *sy, const struct MAPDRAW_DATA *draw_data, unsigned int px, unsigned int py) |
Returns subtile coordinates for given graphics map position. | |
DLLIMPORT short | get_subtile_from_draw_coords_ip (struct IPOINT_2D *subtl, struct IPOINT_2D *subpos, const struct MAPDRAW_DATA *draw_data, unsigned int px, unsigned int py) |
Returns subtile coordinates for given graphics map position. | |
DLLIMPORT short | get_subtile_from_draw_coords_adv (unsigned int *ssx, unsigned int *ssy, const struct MAPDRAW_DATA *draw_data, unsigned int px, unsigned int py) |
Returns subtile coordinates for given graphics map position. | |
short | get_subtile_from_draw_coords_adv_fast (unsigned int *ssx, unsigned int *ssy, const struct IPOINT_2D scaled_txtr_size, const struct IPOINT_2D start, unsigned int px, unsigned int py) |
Returns subtile coordinates for given graphics map position. | |
DLLIMPORT short | get_full_draw_dimensions (struct IPOINT_2D *gdim, const struct MAPDRAW_DATA *draw_data) |
Returns full dimensions of the level graphics view in current scale. | |
DLLIMPORT short | get_full_draw_dimensions_opt (struct IPOINT_2D *gdim, const struct UPOINT_2D *subtl, const struct MAPDRAW_OPTIONS *opts) |
Returns full dimensions of the level graphics view in current scale. | |
DLLIMPORT short | get_thing_with_circle_at (unsigned int *sx, unsigned int *sy, unsigned int *num, const struct MAPDRAW_DATA *draw_data, const struct LEVEL *lvl, unsigned int px, unsigned int py) |
Returns a thing which is at given position in map image buffer. | |
DLLIMPORT short | get_object_with_circle_at (unsigned int *sx, unsigned int *sy, unsigned int *z, const struct MAPDRAW_DATA *draw_data, const struct LEVEL *lvl, unsigned int px, unsigned int py) |
Returns an object which is at given position in map image buffer. |
#define ERR_DRAW_BADCUBE -34 |
#define ERR_DRAW_BADTXTR -33 |
#define SIN_ACOS_SIZE 1024 |
Definition at line 41 of file draw_map.h.
Referenced by draw_circle_fill(), draw_circle_mul(), and load_draw_data().
enum BMFONT_OPTIONS |
Definition at line 26 of file draw_map.h.
enum TNGFLG_OPTIONS |
DLLIMPORT short change_draw_data_texture | ( | struct MAPDRAW_DATA * | draw_data, | |
const struct MAPDRAW_OPTIONS * | opts, | |||
const int | textr_idx | |||
) |
Changes loaded texture in the MAPDRAW_DATA structure.
Loads the new texture file from disk into draw_data.
draw_data | Destination structure. | |
opts | Drawing options. | |
textr_idx | New texture file index. |
Definition at line 2320 of file draw_map.c.
Referenced by load_draw_data().
DLLIMPORT short draw_map_on_buffer | ( | char * | dest, | |
const struct LEVEL * | lvl, | |||
struct MAPDRAW_DATA * | draw_data, | |||
unsigned int | anim | |||
) |
Draws given LEVEL on given buffer, using graphics and options from MAPDRAW_DATA.
dest | The destination buffer. | |
lvl | Source level to draw. | |
draw_data | Graphics textures, sprites and options. | |
anim | Number of the animation frame. |
Definition at line 1505 of file draw_map.c.
Referenced by generate_map_bitmap().
DLLIMPORT short draw_map_on_buffer_fast | ( | char * | dest, | |
const struct LEVEL * | lvl, | |||
struct MAPDRAW_DATA * | draw_data, | |||
unsigned int | anim | |||
) |
Draws given LEVEL on given buffer, using graphics and options from MAPDRAW_DATA.
Fast version - but a little less quality on rescaling.
dest | The destination buffer. | |
lvl | Source level to draw. | |
draw_data | Graphics textures, sprites and options. | |
anim | Number of the animation frame. |
Definition at line 1654 of file draw_map.c.
DLLIMPORT short draw_text_on_buffer | ( | char * | dest, | |
const int | px, | |||
const int | py, | |||
const char * | text, | |||
struct MAPDRAW_DATA * | draw_data, | |||
short | font | |||
) |
Draws text on given buffer, using graphics and options from MAPDRAW_DATA.
dest | The destination buffer. | |
px,py | Start point for the dawing in dest buffer. | |
text | Source text message. | |
draw_data | Graphics textures, sprites and options. | |
font | Font selector. |
Definition at line 2002 of file draw_map.c.
DLLIMPORT short draw_things_on_buffer | ( | char * | dest, | |
const struct LEVEL * | lvl, | |||
struct MAPDRAW_DATA * | draw_data | |||
) |
Draws things from given LEVEL on given buffer, using graphics and options from MAPDRAW_DATA.
dest | The destination buffer. | |
lvl | Source level to draw things from. | |
draw_data | Graphics textures, sprites and options. |
Definition at line 1820 of file draw_map.c.
Referenced by generate_map_bitmap().
DLLIMPORT short free_draw_data | ( | struct MAPDRAW_DATA * | draw_data | ) |
Frees the MAPDRAW_DATA structure.
draw_data | Destination structure. |
Definition at line 2340 of file draw_map.c.
Referenced by generate_map_bitmap(), and load_draw_data().
DLLIMPORT short generate_map_bitmap | ( | const char * | bmpfname, | |
const struct LEVEL * | lvl, | |||
const struct MAPDRAW_OPTIONS * | opts | |||
) |
Generates bitmap representing the current map layout.
The result is stored into given file name. Loads all data files every time it's executed.
bmpfname | Output bitmap file name. | |
lvl | Source level to draw map from. | |
opts | Drawing options. |
Definition at line 2671 of file draw_map.c.
Referenced by generate_map_bitmap_mapfname().
DLLIMPORT short generate_map_bitmap_mapfname | ( | struct LEVEL * | lvl | ) |
Generates bitmap representing the current map layout.
Saves it on the filename same as level name, and with BMP extension.
lvl | Source level to draw map from. |
Definition at line 2726 of file draw_map.c.
DLLIMPORT short get_draw_subtile_rect | ( | struct IPOINT_2D * | sstart, | |
struct IPOINT_2D * | sdim, | |||
const struct MAPDRAW_DATA * | draw_data, | |||
unsigned int | sx, | |||
unsigned int | sy | |||
) |
Returns coordinates of a graphics buffer rectangle where specific subtile is.
sstart | Subtile start (top left) coordinates. | |
sdim | Subtile dimensions. Adding them to sstart will give you end (bottom right) coordinates. | |
draw_data | The drawing data structure. | |
sx,sy | Coords of the subtile we want to get graphics rectangle for. |
Definition at line 2390 of file draw_map.c.
DLLIMPORT short get_draw_tile_rect | ( | struct IPOINT_2D * | tstart, | |
struct IPOINT_2D * | tdim, | |||
const struct MAPDRAW_DATA * | draw_data, | |||
unsigned int | tx, | |||
unsigned int | ty | |||
) |
Returns coordinates of a graphics buffer rectangle where specific tile is.
tstart | Tile start (top left) coordinates. | |
tdim | Tile dimensions. Adding them to tstart will give you end (bottom right) coordinates. | |
draw_data | The drawing data structure. | |
tx,ty | Coords of the tile we want to get graphics rectangle for. |
Definition at line 2366 of file draw_map.c.
DLLIMPORT short get_full_draw_dimensions | ( | struct IPOINT_2D * | gdim, | |
const struct MAPDRAW_DATA * | draw_data | |||
) |
Returns full dimensions of the level graphics view in current scale.
gdim | Graphics map dimensions. Substracting draw_data->start will give you dimensions from current start position. | |
draw_data | The drawing data structure. |
Definition at line 2628 of file draw_map.c.
DLLIMPORT short get_full_draw_dimensions_opt | ( | struct IPOINT_2D * | gdim, | |
const struct UPOINT_2D * | subtl, | |||
const struct MAPDRAW_OPTIONS * | opts | |||
) |
Returns full dimensions of the level graphics view in current scale.
Requires MAPDRAW_OPTIONS struct and map size instead of MAPDRAW_DATA.
gdim | Graphics map dimensions. Substracting draw_data->start will give you dimensions from current start position. | |
subtl | The map size, in subtiles. | |
opts | The drawing options structure. |
Definition at line 2650 of file draw_map.c.
DLLIMPORT short get_object_with_circle_at | ( | unsigned int * | sx, | |
unsigned int * | sy, | |||
unsigned int * | z, | |||
const struct MAPDRAW_DATA * | draw_data, | |||
const struct LEVEL * | lvl, | |||
unsigned int | px, | |||
unsigned int | py | |||
) |
Returns an object which is at given position in map image buffer.
The (sx,sy,z) indices can be used to get the object data. You can identify the object type by calling get_object_type(lvl,sx,sy,z).
sx,sy,z | Destination indices of object. | |
draw_data | The drawing data structure. | |
lvl | Pointer to the level structure. | |
px,py | Coords of the graphics map point at which we want the object. |
Definition at line 2572 of file draw_map.c.
DLLIMPORT short get_subtile_from_draw_coords | ( | unsigned int * | sx, | |
unsigned int * | sy, | |||
const struct MAPDRAW_DATA * | draw_data, | |||
unsigned int | px, | |||
unsigned int | py | |||
) |
Returns subtile coordinates for given graphics map position.
sx | Destination subtile X coordinate. | |
sy | Destination subtile Y coordinate. | |
draw_data | The drawing data structure. | |
px,py | Coords of the graphics map point at which we want subtile number. |
Definition at line 2413 of file draw_map.c.
DLLIMPORT short get_subtile_from_draw_coords_adv | ( | unsigned int * | ssx, | |
unsigned int * | ssy, | |||
const struct MAPDRAW_DATA * | draw_data, | |||
unsigned int | px, | |||
unsigned int | py | |||
) |
Returns subtile coordinates for given graphics map position.
Returns exact coords within a subtile plus subtile number shifted by 8 bits.
ssx,ssy | Destination coordinates: subtile<<8+subtile_pos. | |
draw_data | The drawing data structure. | |
px,py | Coords of the graphics map point at which we want subtile number. |
Definition at line 2462 of file draw_map.c.
short get_subtile_from_draw_coords_adv_fast | ( | unsigned int * | ssx, | |
unsigned int * | ssy, | |||
const struct IPOINT_2D | scaled_txtr_size, | |||
const struct IPOINT_2D | start, | |||
unsigned int | px, | |||
unsigned int | py | |||
) | [inline] |
Returns subtile coordinates for given graphics map position.
Returns exact coords within a subtile plus subtile number shifted by 8 bits. Fast version - gets scalet texture as parameter, so it don't have to be recomputed.
ssx,ssy | Destination coordinates: subtile<<8+subtile_pos. | |
scaled_txtr_size | The scaled size of texture (subtile size on graphics buffer). | |
start | Map drawing starting coords. | |
px,py | Coords of the graphics map point at which we want subtile number. |
Definition at line 2489 of file draw_map.c.
Referenced by get_object_with_circle_at(), and get_thing_with_circle_at().
DLLIMPORT short get_subtile_from_draw_coords_ip | ( | struct IPOINT_2D * | subtl, | |
struct IPOINT_2D * | subpos, | |||
const struct MAPDRAW_DATA * | draw_data, | |||
unsigned int | px, | |||
unsigned int | py | |||
) |
Returns subtile coordinates for given graphics map position.
Returns exact coords within a subtile.
subtl | Destination subtile coordinates. | |
subpos | Destination position within the subtile. | |
draw_data | The drawing data structure. | |
px,py | Coords of the graphics map point at which we want subtile number. |
Definition at line 2436 of file draw_map.c.
DLLIMPORT short get_thing_with_circle_at | ( | unsigned int * | sx, | |
unsigned int * | sy, | |||
unsigned int * | num, | |||
const struct MAPDRAW_DATA * | draw_data, | |||
const struct LEVEL * | lvl, | |||
unsigned int | px, | |||
unsigned int | py | |||
) |
Returns a thing which is at given position in map image buffer.
The (sx,sy,num) indices can be used to get the thing data like this: get_thing(lvl,sx,sy,num).
sx,sy,num | Destination indices of thing. | |
draw_data | The drawing data structure. | |
lvl | Pointer to the level structure. | |
px,py | Coords of the graphics map point at which we want the thing. |
Definition at line 2513 of file draw_map.c.
DLLIMPORT short load_draw_data | ( | struct MAPDRAW_DATA ** | draw_data, | |
const struct MAPDRAW_OPTIONS * | opts, | |||
const struct UPOINT_2D * | subtl, | |||
const struct IPOINT_2D | bmp_size, | |||
int | textr_idx | |||
) |
Allocates and fills the MAPDRAW_DATA structure.
Loads all data files needed to draw the map. Sets drawing rectangle from (0,0) to bmp_size.
draw_data | Destination structure. | |
opts | Drawing options. | |
subtl | Size of the map, in subtiles. | |
bmp_size | Ending coords of the drawing rectangle. | |
textr_idx | Texture file index. |
Definition at line 2151 of file draw_map.c.
Referenced by generate_map_bitmap().
DLLIMPORT short set_draw_data_rect | ( | struct MAPDRAW_DATA * | draw_data, | |
const int | startx, | |||
const int | starty, | |||
const int | endx, | |||
const int | endy, | |||
const unsigned int | scanline, | |||
const short | rescale | |||
) |
Sets the drawing rectangle in MAPDRAW_DATA structure.
draw_data | Destination structure. | |
startx | Starting coordinate. | |
starty | Starting coordinate. | |
endx | Ending coordinate. | |
endy | Ending coordinate. | |
scanline | Destination buffer scanline length. | |
rescale | Scale factor. |
Definition at line 2073 of file draw_map.c.
Referenced by load_draw_data(), set_draw_data_rect_ip(), and set_draw_data_rect_sl4().
short set_draw_data_rect_ip | ( | struct MAPDRAW_DATA * | draw_data, | |
const struct IPOINT_2D | start, | |||
const struct IPOINT_2D | end, | |||
const unsigned int | scanline, | |||
const short | rescale | |||
) | [inline] |
Sets the drawing rectangle in MAPDRAW_DATA structure.
Uses IPOINT_2D structs instead of single points.
draw_data | Destination structure. | |
start | Starting coordinates. | |
end | Ending coordinates. | |
scanline | Destination buffer scanline length. | |
rescale | Scale factor. |
Definition at line 2111 of file draw_map.c.
short set_draw_data_rect_sl4 | ( | struct MAPDRAW_DATA * | draw_data, | |
const int | startx, | |||
const int | starty, | |||
const int | endx, | |||
const int | endy, | |||
const short | dest_sizex, | |||
const short | rescale | |||
) | [inline] |
Sets the drawing rectangle in MAPDRAW_DATA structure.
Sets a scanline length to be multiplication of 4 - needed in some cases.
draw_data | Destination structure. | |
startx | Starting coordinate. | |
starty | Starting coordinate. | |
endx | Ending coordinate. | |
endy | Ending coordinate. | |
dest_sizex | Destination buffer line size, in pixels. | |
rescale | Scale factor. |
Definition at line 2131 of file draw_map.c.