draw_map.c File Reference


Detailed Description

Graphics draw of Dungeon Keeper map.

Purpose:
Functions needed to create a graphic view of DK1 map using original textures.
Comment:
None.
Author:
Tomasz Lis
Date:
12 Jan 2008 - 22 Jul 2008
Copying and copyrights:
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Definition in file draw_map.c.

#include "draw_map.h"
#include <math.h>
#include "globals.h"
#include "memfile.h"
#include "obj_cube.h"
#include "obj_slabs.h"
#include "lev_data.h"
#include "lev_files.h"
#include "lev_column.h"
#include "obj_column.h"
#include "obj_things.h"
#include "xcubtxtr.h"
#include "xtabdat8.h"
#include "xtabjty.h"

Go to the source code of this file.

Defines

#define THINGCIRCLE_PALETTE_SIZE   14

Functions

void mdrand_setpos (struct MAPDRAW_DATA *draw_data, int sx, int sy)
unsigned int mdrand_t8 (struct MAPDRAW_DATA *draw_data, int tx, int ty, const unsigned int range)
unsigned int mdrand_s8 (struct MAPDRAW_DATA *draw_data, int sx, int sy, const unsigned int range)
unsigned int mdrand_nx8 (struct MAPDRAW_DATA *draw_data, const unsigned int range)
unsigned int mdrand_g8 (const unsigned int range)
void mdrand_g8_waste (const unsigned int num)
short load_palette (struct PALETTE_ENTRY *pal, char *fname)
 Reads RGB palette file into PALETTE_ENTRY array.
void draw_pixel_exact_offs (unsigned char *dest, const unsigned long offset, const struct PALETTE_ENTRY *color)
 Draws one pixel at given offset of destination buffer.
void draw_pixel_mul_offs (unsigned char *dest, const unsigned long offset, const struct PALETTE_ENTRY *color)
 Multiplies color of one pixel at given offset of destination buffer.
void draw_pixel_x4walpha_offs (unsigned char *dest, const unsigned long offset, const unsigned short alpha, const struct PALETTE_ENTRY *color)
 Puts color of one pixel at given offset of destination buffer, uses alpha channel.
void draw_circle_fill (unsigned char *dest, const struct IPOINT_2D dest_pos, const struct IPOINT_2D dest_size, const unsigned int dest_scanln, const struct PALETTE_ENTRY *bcolor, const struct PALETTE_ENTRY *fcolor, int radius)
 Draws filled circle on given buffer.
void draw_circle_mul (unsigned char *dest, const struct IPOINT_2D dest_pos, const struct IPOINT_2D dest_size, const unsigned int dest_scanln, const struct PALETTE_ENTRY *bcolor, const struct PALETTE_ENTRY *fcolor, int radius)
 Draws filled circle on given buffer by multiplying current pixel values.
short place_sprite_cntr_on_buf_rgb (unsigned char *dest, const struct IPOINT_2D dest_pos, const struct IPOINT_2D dest_size, const unsigned int dest_scanln, const struct PALETTE_ENTRY *pal, const struct IMAGEITEM *spr)
 Places given sprite on RGB buffer, centered on given position.
short draw_rect_mul_on_buffer (unsigned char *dest, const struct IPOINT_2D dest_pos, const struct IPOINT_2D dest_size, const unsigned int dest_scanln, const struct IPOINT_2D rect_size, const struct PALETTE_ENTRY *pxdata, const struct IPOINT_2D scale)
 Multiplies values in buffer with given factors.
short draw_rect_sum_on_buffer (unsigned char *dest, const struct IPOINT_2D dest_pos, const struct IPOINT_2D dest_size, const unsigned int dest_scanln, const struct IPOINT_2D rect_size, const struct PALETTE_ENTRY *pxdata, const struct IPOINT_2D scale)
 Adds given factors to values in buffer.
short draw_texture_on_buffer_avg4 (unsigned char *dest, const struct IPOINT_2D dest_pos, const struct IPOINT_2D dest_size, const unsigned int dest_scanln, const unsigned char *src, const struct IPOINT_2D src_pos, const struct IPOINT_2D src_size, const struct IPOINT_2D rect_size, struct PALETTE_ENTRY *pal, const struct IPOINT_2D scale)
 Draws given texture on RGB buffer.
short draw_texture_on_buffer_avg4_unsafe (unsigned char *dest, const struct IPOINT_2D dest_pos, const struct IPOINT_2D dest_size, const unsigned int dest_scanln, const unsigned char *src, const struct IPOINT_2D src_pos, const struct IPOINT_2D src_size, const struct IPOINT_2D rect_size, struct PALETTE_ENTRY *pal, const struct IPOINT_2D scale)
 Draws given texture on RGB buffer.
short draw_texture_on_buffer_avg2 (unsigned char *dest, const struct IPOINT_2D dest_pos, const struct IPOINT_2D dest_size, const unsigned int dest_scanln, const unsigned char *src, const struct IPOINT_2D src_pos, const struct IPOINT_2D src_size, const struct IPOINT_2D rect_size, struct PALETTE_ENTRY *pal, const struct IPOINT_2D scale)
 Draws given texture on RGB buffer.
__fastcall short draw_texture_on_buffer_avg2_fast (unsigned char *dest, const struct IPOINT_2D dest_pos, const struct IPOINT_2D dest_size, const unsigned int dest_scanln, const unsigned char *src, const struct IPOINT_2D src_pos, const struct IPOINT_2D src_size, const struct IPOINT_2D rect_size, struct PALETTE_ENTRY *pal, const struct IPOINT_2D scale)
 Draws given texture on RGB buffer.
__fastcall short draw_texture_on_buffer_avg2_fast_unsafe (unsigned char *dest, const struct IPOINT_2D dest_pos, const struct IPOINT_2D dest_size, const unsigned int dest_scanln, const unsigned char *src, const struct IPOINT_2D src_pos, const struct IPOINT_2D src_size, const struct IPOINT_2D rect_size, struct PALETTE_ENTRY *pal, const struct IPOINT_2D scale)
 Draws given texture on RGB buffer.
short draw_texture_on_buffer_noavg (unsigned char *dest, const struct IPOINT_2D dest_pos, const struct IPOINT_2D dest_size, const unsigned int dest_scanln, const unsigned char *src, const struct IPOINT_2D src_pos, const struct IPOINT_2D src_size, const struct IPOINT_2D rect_size, struct PALETTE_ENTRY *pal, const struct IPOINT_2D scale)
 Draws given texture on RGB buffer.
short draw_texture_on_buffer_noavg_unsafe (unsigned char *dest, const struct IPOINT_2D dest_pos, const struct IPOINT_2D dest_size, const unsigned int dest_scanln, const unsigned char *src, const struct IPOINT_2D src_pos, const struct IPOINT_2D src_size, const struct IPOINT_2D rect_size, struct PALETTE_ENTRY *pal, const struct IPOINT_2D scale)
 Draws given texture on RGB buffer.
short draw_texture_on_buffer_noscale (unsigned char *dest, const struct IPOINT_2D dest_pos, const struct IPOINT_2D dest_size, const unsigned int dest_scanln, const unsigned char *src, const struct IPOINT_2D src_pos, const struct IPOINT_2D src_size, const struct IPOINT_2D rect_size, struct PALETTE_ENTRY *pal)
 Draws given texture on RGB buffer.
short draw_texture_on_buffer (unsigned char *dest, const struct IPOINT_2D dest_pos, const struct IPOINT_2D dest_size, const unsigned int dest_scanln, const unsigned char *src, const struct IPOINT_2D src_pos, const struct IPOINT_2D src_size, const struct IPOINT_2D rect_size, struct PALETTE_ENTRY *pal, const struct IPOINT_2D scale)
 Draws given texture on RGB buffer.
short draw_texture_on_buffer_unsafe (unsigned char *dest, const struct IPOINT_2D dest_pos, const struct IPOINT_2D dest_size, const unsigned int dest_scanln, const unsigned char *src, const struct IPOINT_2D src_pos, const struct IPOINT_2D src_size, const struct IPOINT_2D rect_size, struct PALETTE_ENTRY *pal, const struct IPOINT_2D scale)
 Draws given texture on RGB buffer.
short draw_texture_on_buffer_fast (unsigned char *dest, const struct IPOINT_2D dest_pos, const struct IPOINT_2D dest_size, const unsigned int dest_scanln, const unsigned char *src, const struct IPOINT_2D src_pos, const struct IPOINT_2D src_size, const struct IPOINT_2D rect_size, struct PALETTE_ENTRY *pal, const struct IPOINT_2D scale)
 Draws given texture on RGB buffer.
short draw_texture_on_buffer_fast_unsafe (unsigned char *dest, const struct IPOINT_2D dest_pos, const struct IPOINT_2D dest_size, const unsigned int dest_scanln, const unsigned char *src, const struct IPOINT_2D src_pos, const struct IPOINT_2D src_size, const struct IPOINT_2D rect_size, struct PALETTE_ENTRY *pal, const struct IPOINT_2D scale)
 Draws given texture on RGB buffer.
short texture_index_to_texture_pos (struct IPOINT_2D *texture_pos, const struct CUBES_DATA *cubes, unsigned short textr_idx, unsigned int anim_frame)
 Gives texture coords for given texture index.
short get_top_texture_pos (struct IPOINT_2D *texture_pos, const struct CUBES_DATA *cubes, unsigned short cube_idx, unsigned int anim)
 Gives texture coords for top of the cube with given index.
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.
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.
unsigned int get_objcircle_std_radius (const struct IPOINT_2D scaled_txtr_size)
 Gives radius to draw object circle for unranged objects.
unsigned int get_objcircle_ranged_radius (const struct IPOINT_2D scaled_txtr_size, const unsigned int obj_range, const int secscale)
 Gives radius to draw object circle for ranged objects.
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.
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.
short write_bitmap_rgb (const char *fname, const unsigned char *data, const struct IPOINT_2D size)
 Writes RGB colour bitmap into file with given name.
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.
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.
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.
short free_draw_data (struct MAPDRAW_DATA *draw_data)
 Frees the MAPDRAW_DATA structure.
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.
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.
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.
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.
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.
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.
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.
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.
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.
short generate_map_bitmap (const char *bmpfname, const struct LEVEL *lvl, const struct MAPDRAW_OPTIONS *opts)
 Generates bitmap representing the current map layout.
short generate_map_bitmap_mapfname (struct LEVEL *lvl)
 Generates bitmap representing the current map layout.

Variables

struct PALETTE_ENTRY owned_area_palette_intns []
 Intensified player colors array.
struct PALETTE_ENTRY owned_area_palette_std []
 Standard player colors array.
struct PALETTE_ENTRY owned_area_palette_weak []
 Weak player colors array.
struct PALETTE_ENTRY intense_slab_palette_intns []
 Intense slab colors array.
struct PALETTE_ENTRY intense_slab_palette_std []
 Standard slab colors array.
struct PALETTE_ENTRY minimap_owned_ground []
 Minimap player ground colors array.
struct PALETTE_ENTRY minimap_owned_room []
 Minimap player room colors array.
struct PALETTE_ENTRY minimap_walldoor []
 Minimap slab colors array.
struct PALETTE_ENTRY minimap_pathliquid []
 Minimap slab colors array.
struct PALETTE_ENTRY minimap_gold []
 Minimap slab variations colors array.
struct PALETTE_ENTRY minimap_rock []
 Minimap slab variations colors array.
struct PALETTE_ENTRY minimap_earth []
 Minimap slab variations colors array.
struct PALETTE_ENTRY thingcircle_palette_std []
struct PALETTE_ENTRY thingcircle_palette_weak []
struct PALETTE_ENTRY intense_slab_palette_weak []
 Weak slab colors array.
const char * palette_fname = "palette.dat"
const char * cube_fname = "cube.dat"
const char * tmapanim_fname = "tmapanim.dat"
struct MAPDRAW_DATAglb_draw_data


Define Documentation

#define THINGCIRCLE_PALETTE_SIZE   14

Definition at line 76 of file draw_map.c.

Referenced by draw_things_on_buffer().


Function Documentation

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.

Parameters:
draw_data Destination structure.
opts Drawing options.
textr_idx New texture file index.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 2320 of file draw_map.c.

Referenced by load_draw_data().

void draw_circle_fill ( unsigned char *  dest,
const struct IPOINT_2D  dest_pos,
const struct IPOINT_2D  dest_size,
const unsigned int  dest_scanln,
const struct PALETTE_ENTRY bcolor,
const struct PALETTE_ENTRY fcolor,
int  radius 
) [inline]

Draws filled circle on given buffer.

Parameters:
dest The destination buffer.
dest_pos Position in destination buffer of the circle center.
dest_size Dimensions of destination buffer.
dest_scanln Destination buffer scanline lenght.
bcolor Border color.
fcolor Fill color.
radius Circle radius.

Definition at line 330 of file draw_map.c.

Referenced by draw_things_on_buffer().

void draw_circle_mul ( unsigned char *  dest,
const struct IPOINT_2D  dest_pos,
const struct IPOINT_2D  dest_size,
const unsigned int  dest_scanln,
const struct PALETTE_ENTRY bcolor,
const struct PALETTE_ENTRY fcolor,
int  radius 
) [inline]

Draws filled circle on given buffer by multiplying current pixel values.

Parameters:
dest The destination buffer.
dest_pos Position in destination buffer of the circle center.
dest_size Dimensions of destination buffer.
dest_scanln Destination buffer scanline lenght.
bcolor Border color factors.
fcolor Fill color factors.
radius Circle radius.

Definition at line 449 of file draw_map.c.

Referenced by draw_things_on_buffer().

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.

Parameters:
dest The destination buffer.
lvl Source level to draw.
draw_data Graphics textures, sprites and options.
anim Number of the animation frame.
Returns:
Returns ERR_NONE on success, error code on failure.
Examples:
viewmap.c.

Definition at line 1505 of file draw_map.c.

Referenced by generate_map_bitmap().

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.

Parameters:
dest The destination buffer.
lvl Source level to draw.
draw_data Graphics textures, sprites and options.
anim Number of the animation frame.
Returns:
Returns ERR_NONE on success, error code on failure.
Examples:
putemple.c.

Definition at line 1654 of file draw_map.c.

void draw_pixel_exact_offs ( unsigned char *  dest,
const unsigned long  offset,
const struct PALETTE_ENTRY color 
) [inline]

Draws one pixel at given offset of destination buffer.

Inserts exact PALETTE_ENTRY color values into destination buffer.

Parameters:
dest The destination buffer.
offset Position in destination buffer of the pixel.
color Pixel color.

Definition at line 271 of file draw_map.c.

Referenced by draw_circle_fill().

void draw_pixel_mul_offs ( unsigned char *  dest,
const unsigned long  offset,
const struct PALETTE_ENTRY color 
) [inline]

Multiplies color of one pixel at given offset of destination buffer.

Multiplies PALETTE_ENTRY color values with previous pixel values.

Parameters:
dest The destination buffer.
offset Position in destination buffer of the pixel.
color Pixel color.

Definition at line 286 of file draw_map.c.

Referenced by draw_circle_mul(), and draw_rect_mul_on_buffer().

void draw_pixel_x4walpha_offs ( unsigned char *  dest,
const unsigned long  offset,
const unsigned short  alpha,
const struct PALETTE_ENTRY color 
) [inline]

Puts color of one pixel at given offset of destination buffer, uses alpha channel.

Adds PALETTE_ENTRY color values with previous pixel values, using alpha as factor.

Parameters:
dest The destination buffer.
offset Position in destination buffer of the pixel.
alpha Pixel alpha.
color Pixel color.

Definition at line 307 of file draw_map.c.

Referenced by place_sprite_cntr_on_buf_rgb().

short draw_rect_mul_on_buffer ( unsigned char *  dest,
const struct IPOINT_2D  dest_pos,
const struct IPOINT_2D  dest_size,
const unsigned int  dest_scanln,
const struct IPOINT_2D  rect_size,
const struct PALETTE_ENTRY pxdata,
const struct IPOINT_2D  scale 
)

Multiplies values in buffer with given factors.

Note that this is not clear multiplication, but multiplication+sum.

Parameters:
dest The buffer.
dest_pos Position in buffer of the affected rectangle top left.
dest_size Dimensions of buffer.
dest_scanln Destination buffer scanline lenght.
rect_size Dimensions of affected rectangle.
pxdata Multiply factors.
scale Buffer scale.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 620 of file draw_map.c.

Referenced by draw_map_on_buffer().

short draw_rect_sum_on_buffer ( unsigned char *  dest,
const struct IPOINT_2D  dest_pos,
const struct IPOINT_2D  dest_size,
const unsigned int  dest_scanln,
const struct IPOINT_2D  rect_size,
const struct PALETTE_ENTRY pxdata,
const struct IPOINT_2D  scale 
)

Adds given factors to values in buffer.

Parameters:
dest The buffer.
dest_pos Position in buffer of the affected rectangle top left.
dest_size Dimensions of buffer.
dest_scanln Destination buffer scanline lenght.
rect_size Dimensions of affected rectangle.
pxdata Values to sum with.
scale Buffer scale.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 662 of file draw_map.c.

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.

Parameters:
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.
Returns:
Returns ERR_NONE on success, error code on failure.
Examples:
putemple.c.

Definition at line 2002 of file draw_map.c.

short draw_texture_on_buffer ( unsigned char *  dest,
const struct IPOINT_2D  dest_pos,
const struct IPOINT_2D  dest_size,
const unsigned int  dest_scanln,
const unsigned char *  src,
const struct IPOINT_2D  src_pos,
const struct IPOINT_2D  src_size,
const struct IPOINT_2D  rect_size,
struct PALETTE_ENTRY pal,
const struct IPOINT_2D  scale 
) [inline]

Draws given texture on RGB buffer.

Select best quality drawing method based on scale parameter.

Parameters:
dest The destination buffer.
dest_pos Position in destination buffer of the texture top left.
dest_size Dimensions of destination buffer.
dest_scanln Destination buffer scanline lenght.
src Source texture buffer.
src_pos Source texture position.
src_size Source textures size.
rect_size Texture rectangle size to draw.
pal Texture palette.
scale Destination buffer scale.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 1301 of file draw_map.c.

Referenced by draw_map_on_buffer().

short draw_texture_on_buffer_avg2 ( unsigned char *  dest,
const struct IPOINT_2D  dest_pos,
const struct IPOINT_2D  dest_size,
const unsigned int  dest_scanln,
const unsigned char *  src,
const struct IPOINT_2D  src_pos,
const struct IPOINT_2D  src_size,
const struct IPOINT_2D  rect_size,
struct PALETTE_ENTRY pal,
const struct IPOINT_2D  scale 
)

Draws given texture on RGB buffer.

Optimized for medium rescaled textures. Requires the scale factor to be at least 4 (otherwise the picture may be blurred).

Parameters:
dest The destination buffer.
dest_pos Position in destination buffer of the texture top left.
dest_size Dimensions of destination buffer.
dest_scanln Destination buffer scanline lenght.
src Source texture buffer.
src_pos Source texture position.
src_size Source textures size.
rect_size Texture rectangle size to draw.
pal Texture palette.
scale Destination buffer scale.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 880 of file draw_map.c.

Referenced by draw_texture_on_buffer(), and draw_texture_on_buffer_unsafe().

__fastcall short draw_texture_on_buffer_avg2_fast ( unsigned char *  dest,
const struct IPOINT_2D  dest_pos,
const struct IPOINT_2D  dest_size,
const unsigned int  dest_scanln,
const unsigned char *  src,
const struct IPOINT_2D  src_pos,
const struct IPOINT_2D  src_size,
const struct IPOINT_2D  rect_size,
struct PALETTE_ENTRY pal,
const struct IPOINT_2D  scale 
) [inline]

Draws given texture on RGB buffer.

Fast version, optimized for medium rescaled textures. Requires the scale factor to be at least 4 (otherwise the picture may be blurred).

Parameters:
dest The destination buffer.
dest_pos Position in destination buffer of the texture top left.
dest_size Dimensions of destination buffer.
dest_scanln Destination buffer scanline lenght.
src Source texture buffer.
src_pos Source texture position.
src_size Source textures size.
rect_size Texture rectangle size to draw.
pal Texture palette.
scale Destination buffer scale.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 970 of file draw_map.c.

Referenced by draw_texture_on_buffer_fast().

__fastcall short draw_texture_on_buffer_avg2_fast_unsafe ( unsigned char *  dest,
const struct IPOINT_2D  dest_pos,
const struct IPOINT_2D  dest_size,
const unsigned int  dest_scanln,
const unsigned char *  src,
const struct IPOINT_2D  src_pos,
const struct IPOINT_2D  src_size,
const struct IPOINT_2D  rect_size,
struct PALETTE_ENTRY pal,
const struct IPOINT_2D  scale 
) [inline]

Draws given texture on RGB buffer.

Fast version, optimized for medium rescaled textures. Requires the scale factor to be at least 4 (otherwise the picture may be blurred). Unsafe version - won't check if dest buffer is our of bounds. Do not use it for partially displayed slabs, or it'll crash!

Parameters:
dest The destination buffer.
dest_pos Position in destination buffer of the texture top left.
dest_size Dimensions of destination buffer.
dest_scanln Destination buffer scanline lenght.
src Source texture buffer.
src_pos Source texture position.
src_size Source textures size.
rect_size Texture rectangle size to draw.
pal Texture palette.
scale Destination buffer scale.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 1049 of file draw_map.c.

Referenced by draw_texture_on_buffer_fast_unsafe().

short draw_texture_on_buffer_avg4 ( unsigned char *  dest,
const struct IPOINT_2D  dest_pos,
const struct IPOINT_2D  dest_size,
const unsigned int  dest_scanln,
const unsigned char *  src,
const struct IPOINT_2D  src_pos,
const struct IPOINT_2D  src_size,
const struct IPOINT_2D  rect_size,
struct PALETTE_ENTRY pal,
const struct IPOINT_2D  scale 
)

Draws given texture on RGB buffer.

Optimized for highly rescaled textures. Requires the scale factor to be at least 8 (otherwise the picture may be blurred).

Parameters:
dest The destination buffer.
dest_pos Position in destination buffer of the texture top left.
dest_size Dimensions of destination buffer.
dest_scanln Destination buffer scanline lenght.
src Source texture buffer.
src_pos Source texture position.
src_size Source textures size.
rect_size Texture rectangle size to draw.
pal Texture palette.
scale Destination buffer scale.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 710 of file draw_map.c.

Referenced by draw_texture_on_buffer().

short draw_texture_on_buffer_avg4_unsafe ( unsigned char *  dest,
const struct IPOINT_2D  dest_pos,
const struct IPOINT_2D  dest_size,
const unsigned int  dest_scanln,
const unsigned char *  src,
const struct IPOINT_2D  src_pos,
const struct IPOINT_2D  src_size,
const struct IPOINT_2D  rect_size,
struct PALETTE_ENTRY pal,
const struct IPOINT_2D  scale 
)

Draws given texture on RGB buffer.

Optimized for highly rescaled textures. Requires the scale factor to be at least 8 (otherwise the picture may be blurred). Unsafe version - won't check if dest buffer is our of bounds. Do not use it for partially displayed slabs, or it'll crash!

Parameters:
dest The destination buffer.
dest_pos Position in destination buffer of the texture top left.
dest_size Dimensions of destination buffer.
dest_scanln Destination buffer scanline lenght.
src Source texture buffer.
src_pos Source texture position.
src_size Source textures size.
rect_size Texture rectangle size to draw.
pal Texture palette.
scale Destination buffer scale.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 814 of file draw_map.c.

Referenced by draw_texture_on_buffer_unsafe().

short draw_texture_on_buffer_fast ( unsigned char *  dest,
const struct IPOINT_2D  dest_pos,
const struct IPOINT_2D  dest_size,
const unsigned int  dest_scanln,
const unsigned char *  src,
const struct IPOINT_2D  src_pos,
const struct IPOINT_2D  src_size,
const struct IPOINT_2D  rect_size,
struct PALETTE_ENTRY pal,
const struct IPOINT_2D  scale 
) [inline]

Draws given texture on RGB buffer.

Selects best speed drawing method based on scale parameter.

Parameters:
dest The destination buffer.
dest_pos Position in destination buffer of the texture top left.
dest_size Dimensions of destination buffer.
dest_scanln Destination buffer scanline lenght.
src Source texture buffer.
src_pos Source texture position.
src_size Source textures size.
rect_size Texture rectangle size to draw.
pal Texture palette.
scale Destination buffer scale.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 1375 of file draw_map.c.

Referenced by draw_map_on_buffer_fast().

short draw_texture_on_buffer_fast_unsafe ( unsigned char *  dest,
const struct IPOINT_2D  dest_pos,
const struct IPOINT_2D  dest_size,
const unsigned int  dest_scanln,
const unsigned char *  src,
const struct IPOINT_2D  src_pos,
const struct IPOINT_2D  src_size,
const struct IPOINT_2D  rect_size,
struct PALETTE_ENTRY pal,
const struct IPOINT_2D  scale 
) [inline]

Draws given texture on RGB buffer.

Selects best speed drawing method based on scale parameter. Unsafe version - won't check if dest buffer is our of bounds. Do not use it for partially displayed slabs, or it'll crash!

Parameters:
dest The destination buffer.
dest_pos Position in destination buffer of the texture top left.
dest_size Dimensions of destination buffer.
dest_scanln Destination buffer scanline lenght.
src Source texture buffer.
src_pos Source texture position.
src_size Source textures size.
rect_size Texture rectangle size to draw.
pal Texture palette.
scale Destination buffer scale.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 1409 of file draw_map.c.

Referenced by draw_map_on_buffer_fast().

short draw_texture_on_buffer_noavg ( unsigned char *  dest,
const struct IPOINT_2D  dest_pos,
const struct IPOINT_2D  dest_size,
const unsigned int  dest_scanln,
const unsigned char *  src,
const struct IPOINT_2D  src_pos,
const struct IPOINT_2D  src_size,
const struct IPOINT_2D  rect_size,
struct PALETTE_ENTRY pal,
const struct IPOINT_2D  scale 
)

Draws given texture on RGB buffer.

Optimized for low rescaled textures.

Parameters:
dest The destination buffer.
dest_pos Position in destination buffer of the texture top left.
dest_size Dimensions of destination buffer.
dest_scanln Destination buffer scanline lenght.
src Source texture buffer.
src_pos Source texture position.
src_size Source textures size.
rect_size Texture rectangle size to draw.
pal Texture palette.
scale Destination buffer scale.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 1100 of file draw_map.c.

Referenced by draw_texture_on_buffer(), and draw_texture_on_buffer_fast().

short draw_texture_on_buffer_noavg_unsafe ( unsigned char *  dest,
const struct IPOINT_2D  dest_pos,
const struct IPOINT_2D  dest_size,
const unsigned int  dest_scanln,
const unsigned char *  src,
const struct IPOINT_2D  src_pos,
const struct IPOINT_2D  src_size,
const struct IPOINT_2D  rect_size,
struct PALETTE_ENTRY pal,
const struct IPOINT_2D  scale 
)

Draws given texture on RGB buffer.

Optimized for low rescaled textures. Unsafe version - won't check if dest buffer is our of bounds. Do not use it for partially displayed slabs, or it'll crash!

Parameters:
dest The destination buffer.
dest_pos Position in destination buffer of the texture top left.
dest_size Dimensions of destination buffer.
dest_scanln Destination buffer scanline lenght.
src Source texture buffer.
src_pos Source texture position.
src_size Source textures size.
rect_size Texture rectangle size to draw.
pal Texture palette.
scale Destination buffer scale.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 1194 of file draw_map.c.

Referenced by draw_texture_on_buffer_fast_unsafe(), and draw_texture_on_buffer_unsafe().

short draw_texture_on_buffer_noscale ( unsigned char *  dest,
const struct IPOINT_2D  dest_pos,
const struct IPOINT_2D  dest_size,
const unsigned int  dest_scanln,
const unsigned char *  src,
const struct IPOINT_2D  src_pos,
const struct IPOINT_2D  src_size,
const struct IPOINT_2D  rect_size,
struct PALETTE_ENTRY pal 
)

Draws given texture on RGB buffer.

Optimized for drawing without scaling.

Parameters:
dest The destination buffer.
dest_pos Position in destination buffer of the texture top left.
dest_size Dimensions of destination buffer.
dest_scanln Destination buffer scanline lenght.
src Source texture buffer.
src_pos Source texture position.
src_size Source textures size.
rect_size Texture rectangle size to draw.
pal Texture palette.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 1247 of file draw_map.c.

Referenced by draw_texture_on_buffer(), draw_texture_on_buffer_fast(), draw_texture_on_buffer_fast_unsafe(), and draw_texture_on_buffer_unsafe().

short draw_texture_on_buffer_unsafe ( unsigned char *  dest,
const struct IPOINT_2D  dest_pos,
const struct IPOINT_2D  dest_size,
const unsigned int  dest_scanln,
const unsigned char *  src,
const struct IPOINT_2D  src_pos,
const struct IPOINT_2D  src_size,
const struct IPOINT_2D  rect_size,
struct PALETTE_ENTRY pal,
const struct IPOINT_2D  scale 
) [inline]

Draws given texture on RGB buffer.

Select best quality drawing method based on scale parameter. Unsafe version - won't check if dest buffer is our of bounds. Do not use it for partially displayed slabs, or it'll crash!

Parameters:
dest The destination buffer.
dest_pos Position in destination buffer of the texture top left.
dest_size Dimensions of destination buffer.
dest_scanln Destination buffer scanline lenght.
src Source texture buffer.
src_pos Source texture position.
src_size Source textures size.
rect_size Texture rectangle size to draw.
pal Texture palette.
scale Destination buffer scale.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 1339 of file draw_map.c.

Referenced by draw_map_on_buffer().

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.

Parameters:
dest The destination buffer.
lvl Source level to draw things from.
draw_data Graphics textures, sprites and options.
Returns:
Returns ERR_NONE on success, error code on failure.
Examples:
putemple.c, and viewmap.c.

Definition at line 1820 of file draw_map.c.

Referenced by generate_map_bitmap().

short free_draw_data ( struct MAPDRAW_DATA draw_data  ) 

Frees the MAPDRAW_DATA structure.

Parameters:
draw_data Destination structure.
Returns:
Returns ERR_NONE on success, error code on failure.
Examples:
putemple.c, and viewmap.c.

Definition at line 2340 of file draw_map.c.

Referenced by generate_map_bitmap(), and load_draw_data().

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.

Parameters:
bmpfname Output bitmap file name.
lvl Source level to draw map from.
opts Drawing options.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 2671 of file draw_map.c.

Referenced by generate_map_bitmap_mapfname().

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.

Parameters:
lvl Source level to draw map from.

Definition at line 2726 of file draw_map.c.

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.

Parameters:
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.
Returns:
Returns ERR_NONE on success, error code on failure. On success, returns coordinates in IPOINT_2D structures.

Definition at line 2390 of file draw_map.c.

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.

Parameters:
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.
Returns:
Returns ERR_NONE on success, error code on failure. On success, returns coordinates in IPOINT_2D structures.

Definition at line 2366 of file draw_map.c.

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.

Parameters:
gdim Graphics map dimensions. Substracting draw_data->start will give you dimensions from current start position.
draw_data The drawing data structure.
Returns:
Returns ERR_NONE on success, error code on failure. On success, returns coordinates in IPOINT_2D structures.

Definition at line 2628 of file draw_map.c.

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.

Parameters:
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.
Returns:
Returns ERR_NONE on success, error code on failure. On success, returns coordinates in IPOINT_2D structures.
Examples:
putemple.c, and viewmap.c.

Definition at line 2650 of file draw_map.c.

unsigned int get_objcircle_ranged_radius ( const struct IPOINT_2D  scaled_txtr_size,
const unsigned int  obj_range,
const int  secscale 
) [inline]

Gives radius to draw object circle for ranged objects.

Parameters:
scaled_txtr_size Scaled size of one texture (one subtile).
obj_range Range of the object.
secscale Second scale, for additional scaling.
Returns:
Returns circle radius as integer value.

Definition at line 1803 of file draw_map.c.

Referenced by draw_things_on_buffer().

unsigned int get_objcircle_std_radius ( const struct IPOINT_2D  scaled_txtr_size  )  [inline]

Gives radius to draw object circle for unranged objects.

Parameters:
scaled_txtr_size Scaled size of one texture (one subtile).
Returns:
Returns circle radius as integer value.

Definition at line 1779 of file draw_map.c.

Referenced by draw_things_on_buffer(), get_object_with_circle_at(), and get_thing_with_circle_at().

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).

Parameters:
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.
Returns:
Returns ERR_NONE on success, error code on failure. On success, returns indices in (sx,sy,z).
Examples:
putemple.c.

Definition at line 2572 of file draw_map.c.

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.

Parameters:
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.
Returns:
Returns ERR_NONE on success, error code on failure. On success, returns coordinates in (sx,sy).
Examples:
putemple.c.

Definition at line 2413 of file draw_map.c.

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.

Parameters:
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.
Returns:
Returns ERR_NONE on success, error code on failure. On success, returns coordinates in (sx,sy).

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.

Parameters:
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.
Returns:
Returns ERR_NONE on success, error code on failure. On success, returns coordinates in (sx,sy).

Definition at line 2489 of file draw_map.c.

Referenced by get_object_with_circle_at(), and get_thing_with_circle_at().

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.

Parameters:
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.
Returns:
Returns ERR_NONE on success, error code on failure. On success, returns coordinates in (sx,sy).

Definition at line 2436 of file draw_map.c.

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).

Parameters:
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.
Returns:
Returns ERR_NONE on success, error code on failure. On success, returns indices in (sx,sy,num).

Definition at line 2513 of file draw_map.c.

short get_top_texture_pos ( struct IPOINT_2D texture_pos,
const struct CUBES_DATA cubes,
unsigned short  cube_idx,
unsigned int  anim 
)

Gives texture coords for top of the cube with given index.

Parameters:
texture_pos Destination point for storing coordinates.
cubes The CUBES_DATA structure.
cube_idx Index of the source cube.
anim Number of the animation frame.
Returns:
Returns ERR_NONE on success, and texture coords for top of the cube in texture_pos parameter.

Definition at line 1478 of file draw_map.c.

Referenced by draw_map_on_buffer(), and draw_map_on_buffer_fast().

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.

Parameters:
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.
Returns:
Returns ERR_NONE on success, error code on failure.
Examples:
putemple.c, and viewmap.c.

Definition at line 2151 of file draw_map.c.

Referenced by generate_map_bitmap().

short load_palette ( struct PALETTE_ENTRY pal,
char *  fname 
)

Reads RGB palette file into PALETTE_ENTRY array.

Uses MEMORY_FILE for reading - accepts compressed input files.

Parameters:
pal The destination array of palette entries.
fname Source file name.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 234 of file draw_map.c.

Referenced by load_draw_data().

unsigned int mdrand_g8 ( const unsigned int  range  )  [inline]

void mdrand_g8_waste ( const unsigned int  num  )  [inline]

unsigned int mdrand_nx8 ( struct MAPDRAW_DATA draw_data,
const unsigned int  range 
) [inline]

Definition at line 207 of file draw_map.c.

unsigned int mdrand_s8 ( struct MAPDRAW_DATA draw_data,
int  sx,
int  sy,
const unsigned int  range 
) [inline]

Definition at line 193 of file draw_map.c.

void mdrand_setpos ( struct MAPDRAW_DATA draw_data,
int  sx,
int  sy 
) [inline]

Definition at line 171 of file draw_map.c.

Referenced by draw_map_on_buffer(), draw_map_on_buffer_fast(), and draw_things_on_buffer().

unsigned int mdrand_t8 ( struct MAPDRAW_DATA draw_data,
int  tx,
int  ty,
const unsigned int  range 
) [inline]

Definition at line 179 of file draw_map.c.

short place_sprite_cntr_on_buf_rgb ( unsigned char *  dest,
const struct IPOINT_2D  dest_pos,
const struct IPOINT_2D  dest_size,
const unsigned int  dest_scanln,
const struct PALETTE_ENTRY pal,
const struct IMAGEITEM spr 
)

Places given sprite on RGB buffer, centered on given position.

Parameters:
dest The destination buffer.
dest_pos Position in destination buffer of the sprite center.
dest_size Dimensions of destination buffer.
dest_scanln Destination buffer scanline lenght.
pal Sprite palette.
spr The sprite to place on buffer.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 568 of file draw_map.c.

Referenced by draw_text_on_buffer(), and draw_things_on_buffer().

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.

See also:
set_draw_data_rect_ip
Parameters:
draw_data Destination structure.
startx Starting coordinate.
starty Starting coordinate.
endx Ending coordinate.
endy Ending coordinate.
scanline Destination buffer scanline length.
rescale Scale factor.
Returns:
Returns ERR_NONE on success, error code on failure.
Examples:
putemple.c, and viewmap.c.

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.

See also:
set_draw_data_rect
Parameters:
draw_data Destination structure.
start Starting coordinates.
end Ending coordinates.
scanline Destination buffer scanline length.
rescale Scale factor.
Returns:
Returns ERR_NONE on success, error code on failure.

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.

See also:
set_draw_data_rect
Parameters:
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.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 2131 of file draw_map.c.

short texture_index_to_texture_pos ( struct IPOINT_2D texture_pos,
const struct CUBES_DATA cubes,
unsigned short  textr_idx,
unsigned int  anim_frame 
) [inline]

Gives texture coords for given texture index.

Parameters:
texture_pos Destination point for storing coordinates.
cubes The CUBES_DATA structure.
textr_idx Index of the texture.
anim_frame Number of the animation frame.
Returns:
Returns ERR_NONE on success, and texture coords in texture_pos parameter.

Definition at line 1434 of file draw_map.c.

Referenced by draw_map_on_buffer(), draw_map_on_buffer_fast(), and get_top_texture_pos().

short write_bitmap_rgb ( const char *  fname,
const unsigned char *  data,
const struct IPOINT_2D  size 
)

Writes RGB colour bitmap into file with given name.

Parameters:
fname Destination file name.
data Bitmap data buffer.
size Bitmap width and height.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 2037 of file draw_map.c.

Referenced by generate_map_bitmap().


Variable Documentation

const char* cube_fname = "cube.dat"

Definition at line 166 of file draw_map.c.

Referenced by load_draw_data().

Definition at line 169 of file draw_map.c.

Initial value:


 { {248,80,136,0}, {224,224,16,0}, }
Intense slab colors array.

This array containing color intensity added to bitmap where slab colors should be intensified.

Definition at line 64 of file draw_map.c.

Initial value:


 { {124,40,68,0}, {112,112,8,0}, }
Standard slab colors array.

This array containing color intensity added to bitmap where slab colors should be intensified.

Definition at line 72 of file draw_map.c.

Initial value:


 { {62,20,34,0}, {56,56,4,0}, }
Weak slab colors array.

This array containing color intensity added to bitmap where slab colors should be intensified.

Definition at line 161 of file draw_map.c.

Initial value:

 { {56,48,16,0}, {48,44,16,0}, {60,48,16,0}, {72,50,16,0}, {72,56,16,0}, }
Minimap slab variations colors array.

Definition at line 119 of file draw_map.c.

Initial value:

 { {140,136,36,0}, {140,136,36,0}, {160,132,36,0}, {160,136,40,0}, {140,128,28,0}, }
Minimap slab variations colors array.

Definition at line 107 of file draw_map.c.

Initial value:

 { {208,84,16,0}, {216,180,232,0}, {96,152,28,0}, {208,208,16,0}, {208,216,160,0}, {216,216,216,0}, }
Minimap player ground colors array.

Definition at line 81 of file draw_map.c.

Initial value:

 { {244,88,16,0}, {248,216,252,0}, {100,180,36,0}, {252,252,16,0}, {252,248,196,0}, {255,255,255,0}, }
Minimap player room colors array.

Definition at line 87 of file draw_map.c.

Initial value:

 
 { {96,72,28,0}, {140,112,104,0}, {100,60,16,0}, }
Minimap slab colors array.

Definition at line 100 of file draw_map.c.

Initial value:

 { {16,16,16,0}, {20,12,16,0}, {12,20,16,0}, {16,12,20,0}, {18,14,18,0}, }
Minimap slab variations colors array.

Definition at line 113 of file draw_map.c.

Initial value:

 
 { {112,88,60,0}, {224,236,136,0}, {252,208,152,0}, }
Minimap slab colors array.

Definition at line 93 of file draw_map.c.

Initial value:

 { {63,24,11,0}, {47,31,63,0}, {54,63,26,0}, {63,59,0,0}, {52,47,42,0}, {0,0,0,0}, }
Intensified player colors array.

This array containing color intensity added to bitmap where owners should be visible.

Definition at line 40 of file draw_map.c.

Initial value:


 { {186,72,30,0}, {120,78,162,0}, {138,162,66,0}, {186,154,0,0}, {132,114,102,0}, {0,0,0,0}, }
Standard player colors array.

This array containing color intensity added to bitmap where owners should be visible.

Definition at line 47 of file draw_map.c.

Initial value:


 { {62,24,10,0}, {40,26,54,0}, {46,54,22,0}, {62,55,0,0}, {44,38,34,0}, {0,0,0,0}, }
Weak player colors array.

This array containing color intensity added to bitmap where owners should be visible.

Definition at line 55 of file draw_map.c.

const char* palette_fname = "palette.dat"

Definition at line 165 of file draw_map.c.

Referenced by load_draw_data().

Initial value:

 { {176,176,176,0},   
   {224,224,  0,0},   
   {255,255,255,0},   
   {  0, 96,255,0},   
   { 16,255, 16,0},   
   { 16,255, 16,0},   
   {176,176,176,0},   
   { 48, 96,255,0},   
   {255, 32, 32,0},   
   {255,  0,255,0},   
   {176,176,176,0},   
   {176,176,176,0},   
   {  0, 96,255,0},   
   {  0, 96,255,0},   
   }

Definition at line 122 of file draw_map.c.

Initial value:

 { { 88, 88, 88,0},   
   { 48, 48,  8,0},   
   {128,128,128,0},   
   {  0, 48,128,0},   
   {  8,128,  8,0},   
   {  8,128,  8,0},   
   { 88, 88, 88,0},   
   {  8,  8,128,0},   
   {128, 16, 16,0},   
   {128,  0,128,0},   
   { 88, 88, 88,0},   
   { 88, 88, 88,0},   
   {  0, 48,128,0},   
   {  0, 48,128,0},   
   }

Definition at line 139 of file draw_map.c.

const char* tmapanim_fname = "tmapanim.dat"

Definition at line 167 of file draw_map.c.

Referenced by load_draw_data().


Generated on Tue Sep 2 18:51:48 2008 for libAdikted by  doxygen 1.5.6