Definition in file bulcommn.c.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lbfileio.h"
#include "bulcommn.h"
Go to the source code of this file.
Functions | |
short | write_bmp_fn_idx (const char *fname, int width, int height, const unsigned char *pal, const char *data, int red, int green, int blue, int mult) |
Writes indexed colour bitmap into file with given name. | |
short | write_bmp_fp_idx (FILE *out, int width, int height, const unsigned char *pal, const char *data, int red, int green, int blue, int mult) |
Writes indexed colour bitmap into opened file. | |
short | write_bmp_fn_24b (const char *fname, int width, int height, const char *data) |
Writes indexed colour bitmap into file with given name. | |
short | write_bmp_fp_24b (FILE *out, int width, int height, const char *data) |
Writes indexed colour bitmap into opened file. | |
int | read_palette_rgb (unsigned char *palette, const char *fname, unsigned int nColors) |
Reads RGB palette file into preallocated buffer. | |
unsigned int | rnd (const unsigned int range) |
Returns a random number within given range. | |
int | rnc_compressed_buf (unsigned char *buff) |
Gives version of the RNC file. | |
int | rnc_compressed_file (FILE *fp) |
Gives version of the RNC file. | |
Variables | |
char const * | RNC_SIGNATURE_STR = "RNC\001" |
RNC compression magic identifier, as string. |
int read_palette_rgb | ( | unsigned char * | palette, | |
const char * | fname, | |||
unsigned int | nColors | |||
) |
Reads RGB palette file into preallocated buffer.
The input file can't be compressed and must have 768 bytes.
Definition at line 228 of file bulcommn.c.
int rnc_compressed_buf | ( | unsigned char * | buff | ) |
Gives version of the RNC file.
Requies buff to be at least 4 bytes long.
buff | The source buffer. |
Definition at line 255 of file bulcommn.c.
Referenced by rnc_compressed_file().
int rnc_compressed_file | ( | FILE * | fp | ) |
Gives version of the RNC file.
Reads 4 starting bytes of given FILE, and compares three of them with RNC signature. Then returns fourth one.
fp | The opened file. |
Definition at line 272 of file bulcommn.c.
unsigned int rnd | ( | const unsigned int | range | ) |
Returns a random number within given range.
Definition at line 243 of file bulcommn.c.
Referenced by create_columns_slb_claimed(), create_columns_slb_hatchery_floor(), create_columns_slb_library_floor(), create_columns_slb_temple_inside(), create_columns_slb_workshop_inside(), fill_column_claimedgnd_surr(), fill_column_dungheart_inside(), fill_column_earth(), fill_column_earth_nearwater(), fill_column_earthground(), fill_column_gem(), fill_column_gold(), fill_column_gold_nearlava(), fill_column_gold_nearwater(), fill_column_guardpost_floor_a(), fill_column_guardpost_floor_b(), fill_column_guardpost_floor_c(), fill_column_hatchery_inside(), fill_column_library_pillar(), fill_column_path(), fill_column_portal_floor(), fill_column_portal_pillar(), fill_column_portal_step(), fill_column_temple_floor(), fill_column_wall_pairshrbrick_a(), fill_column_wall_pairshrbrick_b(), fill_column_wall_pairshrbrick_c(), fill_column_wall_redsmbrick_a(), fill_column_wall_redsmbrick_a_nearlava(), fill_column_wall_redsmbrick_a_nearwater(), fill_column_wall_redsmbrick_b(), fill_column_wall_redsmbrick_c(), fill_column_wall_twinsbrick_a(), fill_column_wall_twinsbrick_b(), fill_column_wall_twinsbrick_c(), fill_column_wall_womanbrick_a(), fill_column_wall_womanbrick_b(), fill_column_wall_womanbrick_c(), generate_map_bitmap(), generate_random_map(), get_random_wall_slab(), modify_frail_columns(), place_column_univ_stair(), place_column_wall_redsmbrick(), place_column_wall_redsmbrick_dkbtm(), and place_room_rndpos().
short write_bmp_fn_24b | ( | const char * | fname, | |
int | width, | |||
int | height, | |||
const char * | data | |||
) |
Writes indexed colour bitmap into file with given name.
fname | Destination file name. | |
width | Bitmap width. | |
height | Bitmap height. | |
data | Bitmap data buffer. |
Definition at line 147 of file bulcommn.c.
short write_bmp_fn_idx | ( | const char * | fname, | |
int | width, | |||
int | height, | |||
const unsigned char * | pal, | |||
const char * | data, | |||
int | red, | |||
int | green, | |||
int | blue, | |||
int | mult | |||
) |
Writes indexed colour bitmap into file with given name.
fname | Destination file name. | |
width | Bitmap width. | |
height | Bitmap height; may be negative to flip the bitmap. | |
pal | RGB Palette buffer. | |
data | Bitmap data buffer. | |
red | Red color position in patette. | |
green | Green color position in patette. | |
blue | Blue color position in patette. | |
mult | Color value multiplier. |
Definition at line 44 of file bulcommn.c.
short write_bmp_fp_24b | ( | FILE * | out, | |
int | width, | |||
int | height, | |||
const char * | data | |||
) |
Writes indexed colour bitmap into opened file.
out | Destination file (already opened for writing). | |
width | Bitmap width. | |
height | Bitmap height. | |
data | Bitmap data buffer. |
Definition at line 171 of file bulcommn.c.
Referenced by write_bitmap_rgb(), and write_bmp_fn_24b().
short write_bmp_fp_idx | ( | FILE * | out, | |
int | width, | |||
int | height, | |||
const unsigned char * | pal, | |||
const char * | data, | |||
int | red, | |||
int | green, | |||
int | blue, | |||
int | mult | |||
) |
Writes indexed colour bitmap into opened file.
out | Destination file (already opened for writing). | |
width | Bitmap width. | |
height | Bitmap height; may be negative to flip the bitmap. | |
pal | RGB Palette buffer. | |
data | Bitmap data buffer. | |
red | Red color position in patette. | |
green | Green color position in patette. | |
blue | Blue color position in patette. | |
mult | Color value multiplier. |
Definition at line 75 of file bulcommn.c.
Referenced by write_bmp_fn_idx().
char const* RNC_SIGNATURE_STR = "RNC\001" |
RNC compression magic identifier, as string.
Definition at line 29 of file bulcommn.c.
Referenced by rnc_compressed_buf().