bulcommn.h File Reference


Detailed Description

Various functions used in many tools for Bullfrog games.

Purpose:
Header file. Defines exported routines from bulcommn.c.
Comment:
None.
Author:
Tomasz Lis
Date:
10 Mar 2005 - 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 bulcommn.h.

#include "globals.h"

Go to the source code of this file.

Functions

DLLIMPORT unsigned int rnd (const unsigned int range)
 Returns a random number within given range.
DLLIMPORT 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.
DLLIMPORT 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.
DLLIMPORT short write_bmp_fn_24b (const char *fname, int width, int height, const char *data)
 Writes indexed colour bitmap into file with given name.
DLLIMPORT short write_bmp_fp_24b (FILE *out, int width, int height, const char *data)
 Writes indexed colour bitmap into opened file.
DLLIMPORT int read_palette_rgb (unsigned char *palette, const char *fname, unsigned int nColors)
 Reads RGB palette file into preallocated buffer.
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.


Function Documentation

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

Returns:
Returns 0 on success, error code on failure.

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.

Parameters:
buff The source buffer.
Returns:
Returns 0 if buff seems not to be RNC compressed, or RNC version (positive number) if buff is compressed.

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.

Parameters:
fp The opened file.
Returns:
Returns 0 if file seems not to be RNC compressed, or RNC version (positive number) if file is compressed.

Definition at line 272 of file bulcommn.c.

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

DLLIMPORT short write_bmp_fn_24b ( const char *  fname,
int  width,
int  height,
const char *  data 
)

Writes indexed colour bitmap into file with given name.

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

Definition at line 147 of file bulcommn.c.

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

Parameters:
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.
Returns:
Returns 0 on success, error code on failure.

Definition at line 44 of file bulcommn.c.

DLLIMPORT short write_bmp_fp_24b ( FILE *  out,
int  width,
int  height,
const char *  data 
)

Writes indexed colour bitmap into opened file.

Parameters:
out Destination file (already opened for writing).
width Bitmap width.
height Bitmap height.
data Bitmap data buffer.
Returns:
Returns 0 on success, error code on failure.

Definition at line 171 of file bulcommn.c.

Referenced by write_bitmap_rgb(), and write_bmp_fn_24b().

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

Parameters:
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.
Returns:
Returns 0 on success, error code on failure.

Definition at line 75 of file bulcommn.c.

Referenced by write_bmp_fn_idx().


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