lev_data.h File Reference


Detailed Description

Struct definitions and LEVEL structure handling routines.

Purpose:
Header file. Defines exported routines from lev_data.c
Comment:
None.
Author:
Jon Skeet, Tomasz Lis
Date:
14 Oct 1997 - 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 lev_data.h.

#include "globals.h"

Go to the source code of this file.

Data Structures

struct  DK_GRAFFITI
 Graffiti structure. More...
struct  DK_SCRIPT_PLAYER
 Script player structure. More...
struct  DK_SCRIPT_PARTYMEMBER
 Script party member structure. More...
struct  DK_SCRIPT_PARTY
 Script party structure. More...
struct  DK_SCRIPT_ADDEVENT
 Script add event structure. More...
struct  DK_SCRIPT_PARAMETERS
 Script parameters structure. More...
struct  DK_SCRIPT
 Complete level script structure. More...
struct  LEVSTATS
 Level statistics structure. More...
struct  LEVINFO
 Level information structure. More...
struct  LEVEL
 The main Level data structure. More...

Defines

#define MAP_SIZE_DKSTD_X   85
#define MAP_SIZE_DKSTD_Y   85
#define MAP_SIZE_H   1
#define MAP_SUBNUM_H   8
#define MAP_SUBNUM_X   3
#define MAP_SUBNUM_Y   3
#define COLUMN_ENTRIES   2048
#define SIZEOF_DK_TNG_REC   21
#define SIZEOF_DK_CLM_REC   24
#define SIZEOF_DK_APT_REC   8
#define SIZEOF_DK_LGT_REC   20
#define SIZEOF_DK_CLM_HEADER   8
#define SIZEOF_DK_APT_HEADER   4
#define SIZEOF_DK_LGT_HEADER   4
#define SIZEOF_DK_TNG_HEADER   2

Enumerations

enum  MAP_FORMAT_VERSION {
  MFV_DKSTD = 0, MFV_DKGOLD = 1, MFV_DKXPAND = 2, MFV_DK2STD = 10,
  MFV_DK2OFC = 11
}
 Map format type selection. More...
enum  OBJECT_TYPE_INDEX {
  OBJECT_TYPE_NONE = 0, OBJECT_TYPE_ACTNPT = 1, OBJECT_TYPE_THING = 2, OBJECT_TYPE_STLIGHT = 3,
  OBJECT_TYPE_COLUMN = 16, OBJECT_TYPE_SLAB = 17, OBJECT_TYPE_DATLST = 18
}
enum  VERIFY_WARN_FLAGS { VWFLAG_NONE = 0, VWFLAG_NOWARN_MANYHEART = 1 }
enum  DIRECTION_INDEX {
  IDIR_CENTR = 4, IDIR_NW = 0, IDIR_NORTH = 1, IDIR_NE = 2,
  IDIR_EAST = 5, IDIR_SE = 8, IDIR_SOUTH = 7, IDIR_SW = 6,
  IDIR_WEST = 3
}
 Direction indices. More...
enum  GRAFFITI_ORIENT {
  ORIENT_NS = 0x00, ORIENT_WE = 0x01, ORIENT_SN = 0x02, ORIENT_EW = 0x03,
  ORIENT_TNS = 0x04, ORIENT_TWE = 0x05, ORIENT_TSN = 0x06, ORIENT_TEW = 0x07
}
 Orientation - for graffiti. More...
enum  GRAFFITI_FONT { GRAFF_FONT_NONE = 0x00, GRAFF_FONT_ADICLSSC = 0x01, GRAFF_FONT_ADISIZE8 = 0x02 }
 Font - for graffiti. More...
enum  STATS_LINE_TYPE {
  STLT_NONE = 0, STLT_HEADER = 1, STLT_MAINITEM = 2, STLT_SUBITEM = 3,
  STLT_EMPTY = 4
}
 Statistics line types. More...

Functions

DLLIMPORT short level_init (struct LEVEL **lvl_ptr, short map_version, struct UPOINT_3D *lvl_size)
 Creates object for storing one level.
DLLIMPORT short level_deinit (struct LEVEL **lvl_ptr)
 Frees structures for storing level.
DLLIMPORT short level_set_options (struct LEVEL *lvl, struct LEVOPTIONS *optns)
 Sets all options for the LEVEL structure from another LEVOPTIONS.
DLLIMPORT struct LEVOPTIONSlevel_get_options (struct LEVEL *lvl)
 Gets all options for the LEVEL structure.
DLLIMPORT short level_set_mapdraw_options (struct LEVEL *lvl, struct MAPDRAW_OPTIONS *mdrwopts)
 Sets the map drawing options for the LEVEL structure from another MAPDRAW_OPTIONS.
DLLIMPORT struct MAPDRAW_OPTIONSlevel_get_mapdraw_options (struct LEVEL *lvl)
 Gets the map drawing options for the LEVEL structure.
DLLIMPORT short level_clear (struct LEVEL *lvl)
 Clears the whole object for storing level.
short level_clear_tng (struct LEVEL *lvl)
 Clears the "things" structure for storing level.
short level_clear_apt (struct LEVEL *lvl)
 clears the "actions" structure for storing level.
short level_clear_lgt (struct LEVEL *lvl)
 clears the "lights" structure for storing level.
short level_clear_datclm (struct LEVEL *lvl)
 Clears the "column" structure for storing level.
short level_clear_other (struct LEVEL *lvl)
 Clears minor LEVEL substructures.
short level_clear_stats (struct LEVEL *lvl)
 Clears (via zeroing) stats for given level.
short level_clear_info (struct LEVEL *lvl)
 Clears (sets for new map) info for given level.
short level_clear_script (struct LEVEL *lvl)
 Clears (via zeroing) TXT script info for given level.
DLLIMPORT short level_clear_script_param (struct DK_SCRIPT_PARAMETERS *par)
 Clears (via zeroing) given script parameters struct.
DLLIMPORT short level_clear_options (struct LEVOPTIONS *optns)
 Clears options for given level.
DLLIMPORT short level_free (struct LEVEL *lvl)
 Frees structures for storing level.
short level_free_tng (struct LEVEL *lvl)
 Frees "things" structure for storing level.
DLLIMPORT short level_free_script_param (struct DK_SCRIPT_PARAMETERS *par)
 Frees all sub-structures of given DK_SCRIPT_PARAMETERS.
DLLIMPORT short free_text_file (char ***lines, int *lines_count)
 Frees any text file loaded as lines.
DLLIMPORT short level_verify (struct LEVEL *lvl, char *actn_name, struct IPOINT_2D *errpt)
 Verifies the whole level.
DLLIMPORT short level_verify_struct (struct LEVEL *lvl, char *err_msg, struct IPOINT_2D *errpt)
 Verifies internal LEVEL structure integrity.
short actnpts_verify (struct LEVEL *lvl, char *err_msg, struct IPOINT_2D *errpt)
 Verifies action points parameters.
DLLIMPORT short level_verify_logic (struct LEVEL *lvl, char *err_msg, struct IPOINT_2D *errpt)
 Verifies various logic aspects of a map.
DLLIMPORT void start_new_map (struct LEVEL *lvl)
 Creates new level.
DLLIMPORT void generate_random_map (struct LEVEL *lvl)
 Creates random level.
DLLIMPORT void generate_slab_bkgnd_default (struct LEVEL *lvl, unsigned short def_slab)
 Fills SLB/OWN structure with "default" background.
DLLIMPORT void generate_slab_bkgnd_random (struct LEVEL *lvl)
 Fills SLB/OWN structure with "random" background.
DLLIMPORT short level_generate_random_extension (struct LEVEL *lvl, char *ret_msg)
 Adds random extension to the level.
DLLIMPORT struct
DK_SCRIPT_PARAMETERS
level_get_script_param (struct LEVEL *lvl)
 Returns DK_SCRIPT_PARAMETERS struct for given level.
DLLIMPORT void free_map (struct LEVEL *lvl)
 Frees the level data stored in LEVEL structure.
DLLIMPORT char * get_thing (const struct LEVEL *lvl, unsigned int sx, unsigned int sy, unsigned int num)
 Returns thing data for thing at given position.
DLLIMPORT int thing_add (struct LEVEL *lvl, unsigned char *thing)
 Adds a thing to the structure and returns its index.
DLLIMPORT void thing_del (struct LEVEL *lvl, unsigned int sx, unsigned int sy, unsigned int num)
 Removes given thing from the LEVEL structure, updates counter variables.
DLLIMPORT void thing_drop (struct LEVEL *lvl, unsigned int sx, unsigned int sy, unsigned int num)
 Removes given thing from the LEVEL structure, updates counter variables.
DLLIMPORT unsigned int get_thing_subnums (const struct LEVEL *lvl, unsigned int sx, unsigned int sy)
 Gives amount of things existing at given subtile.
DLLIMPORT char * get_actnpt (const struct LEVEL *lvl, unsigned int sx, unsigned int sy, unsigned int num)
 Returns action point data for action point at given position.
DLLIMPORT int actnpt_add (struct LEVEL *lvl, unsigned char *actnpt)
 Adds a given action point to the LEVEL structure.
DLLIMPORT void actnpt_del (struct LEVEL *lvl, unsigned int sx, unsigned int sy, unsigned int num)
 Removes given action point from the LEVEL structure.
DLLIMPORT unsigned int get_actnpt_subnums (const struct LEVEL *lvl, unsigned int sx, unsigned int sy)
 Gives amount of action points existing at given subtile.
DLLIMPORT char * get_stlight (const struct LEVEL *lvl, unsigned int sx, unsigned int sy, unsigned int num)
 Returns static light data for light at given position.
DLLIMPORT int stlight_add (struct LEVEL *lvl, unsigned char *stlight)
 Adds a given static light to the LEVEL structure.
DLLIMPORT void stlight_del (struct LEVEL *lvl, unsigned int sx, unsigned int sy, unsigned int num)
 Removes given static light from the LEVEL structure.
DLLIMPORT unsigned int get_stlight_subnums (const struct LEVEL *lvl, unsigned int sx, unsigned int sy)
 Gives amount of static lights existing at given subtile.
DLLIMPORT short get_object_type (const struct LEVEL *lvl, unsigned int sx, unsigned int sy, unsigned int z)
 Checks what type the object is.
DLLIMPORT unsigned char * get_object (const struct LEVEL *lvl, unsigned int sx, unsigned int sy, unsigned int z)
 Returns data for specific object at given position.
DLLIMPORT void object_del (struct LEVEL *lvl, unsigned int sx, unsigned int sy, unsigned int z)
 Deletes object with given coordinates and index.
DLLIMPORT unsigned int get_object_subnums (const struct LEVEL *lvl, unsigned int sx, unsigned int sy)
 Gives amount of objects existing at given subtile.
DLLIMPORT unsigned int get_object_tilnums (const struct LEVEL *lvl, unsigned int tx, unsigned int ty)
 Gives amount of objects existing at given tile.
DLLIMPORT int get_object_subtl_last (const struct LEVEL *lvl, unsigned int sx, unsigned int sy, short obj_type)
 Gives index of the last object with given type.
DLLIMPORT void update_object_owners (struct LEVEL *lvl)
DLLIMPORT unsigned int get_lgt_total_count (struct LEVEL *lvl)
 Returns total number of static lights on the level.
DLLIMPORT unsigned int get_apt_total_count (struct LEVEL *lvl)
 Returns total number of action points on the level.
DLLIMPORT unsigned int get_tng_total_count (struct LEVEL *lvl)
 Returns total number of things on the level.
DLLIMPORT short get_datclm_auto_update (struct LEVEL *lvl)
 Returns state of the datclm_auto_update option for the level.
DLLIMPORT short switch_datclm_auto_update (struct LEVEL *lvl)
 Switches state of the datclm_auto_update option for the level.
DLLIMPORT short set_datclm_auto_update (struct LEVEL *lvl, short val)
 Sets state of the datclm_auto_update option for the level.
DLLIMPORT short get_obj_auto_update (struct LEVEL *lvl)
 Returns state of the obj_auto_update option for the level.
DLLIMPORT short switch_obj_auto_update (struct LEVEL *lvl)
 Switches state of the obj_auto_update option for the level.
DLLIMPORT short set_obj_auto_update (struct LEVEL *lvl, short val)
 Sets state of the obj_auto_update option for the level.
DLLIMPORT short get_subtl_wib (struct LEVEL *lvl, unsigned int sx, unsigned int sy)
 Gives WIBble value for a subtile.
DLLIMPORT void set_subtl_wib (struct LEVEL *lvl, unsigned int sx, unsigned int sy, short nval)
 Sets WIBble value for a subtile.
DLLIMPORT short get_tile_wlb (struct LEVEL *lvl, unsigned int tx, unsigned int ty)
 Gives WLB (Water-Lava Block) value for a tile.
DLLIMPORT void set_tile_wlb (struct LEVEL *lvl, unsigned int tx, unsigned int ty, short nval)
 Sets WLB (Water-Lava Block) value for a tile.
DLLIMPORT unsigned char get_tile_owner (const struct LEVEL *lvl, unsigned int tx, unsigned int ty)
 Gives owner (OWN value) for a tile.
DLLIMPORT void set_tile_owner (struct LEVEL *lvl, unsigned int tx, unsigned int ty, unsigned char nval)
 Sets owner (OWN value) for a tile.
DLLIMPORT unsigned char get_subtl_owner (const struct LEVEL *lvl, unsigned int sx, unsigned int sy)
 Gives owner (OWN value) for a subtile.
DLLIMPORT void set_subtl_owner (struct LEVEL *lvl, unsigned int sx, unsigned int sy, unsigned char nval)
 Sets owner (OWN value) for a subtile.
DLLIMPORT short user_set_tile_owner (struct LEVEL *lvl, unsigned int tx, unsigned int ty, unsigned short nown)
 Changes owner of one slab on map.
DLLIMPORT short user_set_owner_rect (struct LEVEL *lvl, unsigned int startx, unsigned int endx, unsigned int starty, unsigned int endy, unsigned short nown)
 Changes owner of a map rectangle.
DLLIMPORT unsigned short get_tile_slab (const struct LEVEL *lvl, unsigned int tx, unsigned int ty)
 Gives slab (SLB value) for a tile.
DLLIMPORT void set_tile_slab (struct LEVEL *lvl, unsigned int tx, unsigned int ty, unsigned short nval)
 Sets a new value to SLB item, without updating DAT or CLM or anything.
DLLIMPORT short user_set_slab (struct LEVEL *lvl, unsigned int tx, unsigned int ty, unsigned short nslab)
 Puts a new slab on map.
DLLIMPORT short user_set_slab_rect (struct LEVEL *lvl, unsigned int startx, unsigned int endx, unsigned int starty, unsigned int endy, unsigned short nslab)
 Puts a rectangle of new slabs on map.
DLLIMPORT short user_set_slabown_rect (struct LEVEL *lvl, unsigned int startx, unsigned int endx, unsigned int starty, unsigned int endy, unsigned short nslab, unsigned short nown)
 Puts a rectangle of new slabs on map.
DLLIMPORT unsigned int get_dat_val (const struct LEVEL *lvl, const unsigned int sx, const unsigned int sy)
 Returns raw DAT value for one subtile.
DLLIMPORT void set_dat_val (struct LEVEL *lvl, int sx, int sy, unsigned int d)
 Sets a DAT value for one subtile.
DLLIMPORT unsigned short get_subtl_flg (struct LEVEL *lvl, unsigned int sx, unsigned int sy)
 Returns FLG value for one subtile.
DLLIMPORT void set_subtl_flg (struct LEVEL *lvl, unsigned int sx, unsigned int sy, unsigned short nval)
 Sets a FLG value for one subtile.
DLLIMPORT short set_lvl_fname (struct LEVEL *lvl, char *fname)
 Sets map file name for the level.
DLLIMPORT short format_lvl_fname (struct LEVEL *lvl, char *namefmt)
 Sets map file name for the level, using given format string.
DLLIMPORT char * get_lvl_fname (struct LEVEL *lvl)
 Returns map file name for the level.
DLLIMPORT short set_lvl_savfname (struct LEVEL *lvl, char *fname)
 Sets map file name for saving the level.
DLLIMPORT short format_lvl_savfname (struct LEVEL *lvl, char *namefmt)
 Sets map save file name for the level, using given format string.
DLLIMPORT char * get_lvl_savfname (struct LEVEL *lvl)
 Returns save file name for the level.
DLLIMPORT short set_levels_path (struct LEVEL *lvl, char *lvpath)
 Sets path at which maps are.
DLLIMPORT char * get_levels_path (struct LEVEL *lvl)
 Returns path to folder with levels.
DLLIMPORT short set_data_path (struct LEVEL *lvl, char *datpath)
 Sets path at which data files are.
DLLIMPORT char * get_data_path (struct LEVEL *lvl)
 Returns path to folder with data files.
DLLIMPORT char * get_lif_name_text (struct LEVEL *lvl)
 Returns text name of the level, from LIF file.
DLLIMPORT short set_lif_name_text (struct LEVEL *lvl, char *name)
 Sets text name of the level, from LIF file.
DLLIMPORT struct DK_SCRIPTget_lvl_script (struct LEVEL *lvl)
 Returns pointer to the level script structure.
DLLIMPORT struct LEVSTATSget_lvl_stats (struct LEVEL *lvl)
 Returns pointer to the level statistics structure.
DLLIMPORT unsigned long inc_info_usr_mdswtch_count (struct LEVEL *lvl)
 Increases mode switches counter.
DLLIMPORT unsigned long inc_info_usr_cmds_count (struct LEVEL *lvl)
 Increases total user commands counter.
DLLIMPORT unsigned long inc_info_usr_slbchng_count (struct LEVEL *lvl)
 Increases SLB changes counter.
DLLIMPORT unsigned long inc_info_usr_creatobj_count (struct LEVEL *lvl)
 Increases user objects created counter.
DLLIMPORT unsigned int inc_info_ver_major (struct LEVEL *lvl)
 Increases major version number for the level.
DLLIMPORT unsigned int inc_info_ver_minor (struct LEVEL *lvl)
 Increases minor version number for the level.
DLLIMPORT unsigned int inc_info_ver_rel (struct LEVEL *lvl)
 Increases version release number for the level.
DLLIMPORT void update_level_stats (struct LEVEL *lvl)
 Updates some statistics about the level.
DLLIMPORT void update_things_stats (struct LEVEL *lvl)
 Updates statistics about the level.
DLLIMPORT void update_thing_stats (struct LEVEL *lvl, const unsigned char *thing, short change)
 Updates statistics about the thing.
DLLIMPORT short get_level_objstats_textln (struct LEVEL *lvl, char *stat_buf, const int line_num)
 Formats object statistics text line.
DLLIMPORT unsigned char get_lvl_inf (struct LEVEL *lvl)
 Returns INF entry (texture index) for the level.
DLLIMPORT short set_lvl_inf (struct LEVEL *lvl, unsigned char ninf)
 Sets INF entry (texture index) for the level.
DLLIMPORT short get_lvl_format_version (struct LEVEL *lvl)
 Returns level format version.

Variables

const int idir_subtl_x []
const int idir_subtl_y []
const char default_map_name []


Define Documentation

#define COLUMN_ENTRIES   2048

#define MAP_SIZE_DKSTD_X   85

Definition at line 25 of file lev_data.h.

Referenced by effectgen_verify(), and level_init().

#define MAP_SIZE_DKSTD_Y   85

Definition at line 26 of file lev_data.h.

Referenced by level_init().

#define MAP_SIZE_H   1

Definition at line 27 of file lev_data.h.

#define MAP_SUBNUM_H   8

Definition at line 28 of file lev_data.h.

Referenced by thing_verify().

#define MAP_SUBNUM_X   3

Examples:
putemple.c.

Definition at line 29 of file lev_data.h.

Referenced by actnpt_add(), actnpt_del(), actnpts_verify(), columns_verify(), compute_door_orientation(), compute_effectgen_sensitile(), compute_item_sensitile(), compute_torch_sensitile(), create_actnpt(), create_actnpt_number_used_arr(), create_creature(), create_door(), create_doorkey(), create_effectgen(), create_herogate_number_used_arr(), create_item(), create_item_adv(), create_stlight(), create_stlight_copy(), create_thing(), create_thing_copy(), create_torch(), create_trap(), cust_cols_del_for_tile(), cust_cols_num_on_tile(), dat_verify(), delete_room_things(), draw_map_on_buffer(), effectgen_verify(), generate_random_map(), get_actnpt(), get_actnpt_subnums(), get_draw_tile_rect(), get_free_indexedthing_number(), get_object(), get_object_subnums(), get_object_subtl_last(), get_object_type(), get_slab_surround(), get_stlight(), get_stlight_subnums(), get_thing(), get_thing_subnums(), get_tile_owner(), item_verify(), level_clear_apt(), level_clear_datclm(), level_clear_lgt(), level_clear_other(), level_clear_tng(), level_deinit(), level_free_apt(), level_free_lgt(), level_free_tng(), level_init(), level_set_size(), level_verify_logic(), level_verify_struct(), mdrand_t8(), object_del(), owned_things_count(), place_graffiti_on_slab(), set_graffiti_orientation(), set_new_datclm_values(), set_tile_owner(), start_new_map(), stlight_add(), stlight_del(), subtl_in_effectgen_range(), subtl_is_near_tall_slab(), thing_add(), thing_del(), thing_drop(), thing_verify(), things_verify(), update_dat_last_column(), update_door_things_on_slab(), update_thing_slb_room_one_central_item(), update_thing_slb_room_one_item_subtl(), update_thing_subpos_and_height(), update_things_slb_barracks_corner(), update_things_slb_graveyard_corner(), update_things_slb_portal_inside(), update_things_stats(), update_tile_flg_entries(), update_tile_wib_entries(), write_apt(), write_def_clm_source(), write_def_tng_source(), write_lgt(), and write_tng().

#define MAP_SUBNUM_Y   3

Examples:
putemple.c.

Definition at line 30 of file lev_data.h.

Referenced by actnpt_add(), actnpt_del(), actnpts_verify(), columns_verify(), compute_door_orientation(), compute_effectgen_sensitile(), compute_item_sensitile(), compute_torch_sensitile(), create_actnpt(), create_actnpt_number_used_arr(), create_creature(), create_door(), create_doorkey(), create_effectgen(), create_herogate_number_used_arr(), create_item(), create_item_adv(), create_stlight(), create_stlight_copy(), create_thing(), create_thing_copy(), create_torch(), create_trap(), cust_cols_del_for_tile(), cust_cols_num_on_tile(), dat_verify(), delete_room_things(), draw_map_on_buffer(), effectgen_verify(), generate_random_map(), get_actnpt(), get_actnpt_subnums(), get_draw_tile_rect(), get_free_indexedthing_number(), get_object(), get_object_subnums(), get_object_subtl_last(), get_object_type(), get_slab_surround(), get_stlight(), get_stlight_subnums(), get_thing(), get_thing_subnums(), get_tile_owner(), item_verify(), level_clear_apt(), level_clear_datclm(), level_clear_lgt(), level_clear_other(), level_clear_tng(), level_deinit(), level_free_apt(), level_free_lgt(), level_free_tng(), level_init(), level_set_size(), level_verify_logic(), level_verify_struct(), mdrand_t8(), object_del(), owned_things_count(), place_graffiti_on_slab(), set_graffiti_orientation(), set_new_datclm_values(), set_tile_owner(), start_new_map(), stlight_add(), stlight_del(), subtl_in_effectgen_range(), subtl_is_near_tall_slab(), thing_add(), thing_del(), thing_drop(), thing_verify(), things_verify(), update_dat_last_column(), update_door_things_on_slab(), update_thing_slb_room_one_central_item(), update_thing_slb_room_one_item_subtl(), update_thing_subpos_and_height(), update_things_slb_barracks_corner(), update_things_slb_graveyard_corner(), update_things_slb_portal_inside(), update_things_stats(), update_tile_flg_entries(), update_tile_wib_entries(), write_apt(), write_def_clm_source(), write_def_tng_source(), write_lgt(), and write_tng().

#define SIZEOF_DK_APT_HEADER   4

Definition at line 70 of file lev_data.h.

Referenced by load_apt().

#define SIZEOF_DK_APT_REC   8

Definition at line 66 of file lev_data.h.

Referenced by create_actnpt(), create_actnpt_copy(), load_apt(), and write_apt().

#define SIZEOF_DK_CLM_HEADER   8

Definition at line 69 of file lev_data.h.

Referenced by level_clear_datclm(), level_init(), load_clm(), and write_clm().

#define SIZEOF_DK_CLM_REC   24

Definition at line 65 of file lev_data.h.

Referenced by clear_clm_entry(), level_init(), load_clm(), and write_clm().

#define SIZEOF_DK_LGT_HEADER   4

Definition at line 71 of file lev_data.h.

Referenced by load_lgt().

#define SIZEOF_DK_LGT_REC   20

Definition at line 67 of file lev_data.h.

Referenced by create_stlight(), create_stlight_copy(), load_lgt(), and write_lgt().

#define SIZEOF_DK_TNG_HEADER   2

Definition at line 72 of file lev_data.h.

Referenced by load_tng().

#define SIZEOF_DK_TNG_REC   21


Enumeration Type Documentation

Direction indices.

Indices in the 9-element arrays, like slab columns or surround variable.

Enumerator:
IDIR_CENTR 
IDIR_NW 
IDIR_NORTH 
IDIR_NE 
IDIR_EAST 
IDIR_SE 
IDIR_SOUTH 
IDIR_SW 
IDIR_WEST 

Definition at line 78 of file lev_data.h.

Font - for graffiti.

Enumerator:
GRAFF_FONT_NONE 
GRAFF_FONT_ADICLSSC 
GRAFF_FONT_ADISIZE8 

Definition at line 114 of file lev_data.h.

Orientation - for graffiti.

Enumerator:
ORIENT_NS 
ORIENT_WE 
ORIENT_SN 
ORIENT_EW 
ORIENT_TNS 
ORIENT_TWE 
ORIENT_TSN 
ORIENT_TEW 

Definition at line 97 of file lev_data.h.

Map format type selection.

Do not use values other than MFV_DKSTD and MFV_DKGOLD, unless you know what you're doing!

Enumerator:
MFV_DKSTD 
MFV_DKGOLD 
MFV_DKXPAND 
MFV_DK2STD 
MFV_DK2OFC 

Definition at line 38 of file lev_data.h.

Enumerator:
OBJECT_TYPE_NONE 
OBJECT_TYPE_ACTNPT 
OBJECT_TYPE_THING 
OBJECT_TYPE_STLIGHT 
OBJECT_TYPE_COLUMN 
OBJECT_TYPE_SLAB 
OBJECT_TYPE_DATLST 

Definition at line 46 of file lev_data.h.

Statistics line types.

For functions returning statistic texts.

Enumerator:
STLT_NONE 
STLT_HEADER 
STLT_MAINITEM 
STLT_SUBITEM 
STLT_EMPTY 

Definition at line 123 of file lev_data.h.

Enumerator:
VWFLAG_NONE 
VWFLAG_NOWARN_MANYHEART 

Definition at line 56 of file lev_data.h.


Function Documentation

DLLIMPORT int actnpt_add ( struct LEVEL lvl,
unsigned char *  actnpt 
)

Adds a given action point to the LEVEL structure.

Updates counter variables.

Parameters:
lvl Pointer to the LEVEL structure.
actnpt Pointer to the action point data to add.
Returns:
Returns the index at which action point is added, or -1 on error.

Definition at line 1904 of file lev_data.c.

Referenced by load_apt().

DLLIMPORT void actnpt_del ( struct LEVEL lvl,
unsigned int  sx,
unsigned int  sy,
unsigned int  num 
)

Removes given action point from the LEVEL structure.

Updates counter variables. Also frees memory allocated for the action point.

Parameters:
lvl Pointer to the LEVEL structure.
sx,sy Subtile at which the action point is.
num Index of action point on the subtile.

Definition at line 1940 of file lev_data.c.

Referenced by level_free_apt(), and object_del().

short actnpts_verify ( struct LEVEL lvl,
char *  err_msg,
struct IPOINT_2D errpt 
)

Verifies action points parameters.

Parameters:
lvl Pointer to the LEVEL structure.
err_msg Error message output buffer.
errpt Coordinates of the map tile containing the error.
Returns:
Returns VERIF_ERROR, VERIF_WARN or VERIF_OK. If a problem was found, sets err_msg and errpt accordingly.

Definition at line 1349 of file lev_data.c.

Referenced by level_verify().

DLLIMPORT short format_lvl_fname ( struct LEVEL lvl,
char *  namefmt 
)

Sets map file name for the level, using given format string.

The string may be map file name, or map number.

Parameters:
lvl Pointer to the LEVEL structure.
namefmt The new file name, which is copied to the level.
Returns:
Returns true on success, false on error.

Definition at line 2651 of file lev_data.c.

DLLIMPORT short format_lvl_savfname ( struct LEVEL lvl,
char *  namefmt 
)

Sets map save file name for the level, using given format string.

The string may be map file name, or map number.

Parameters:
lvl Pointer to the LEVEL structure.
namefmt The save file name, which is copied to the level.
Returns:
Returns true on success, false on error.

Definition at line 2707 of file lev_data.c.

DLLIMPORT void free_map ( struct LEVEL lvl  ) 

Frees the level data stored in LEVEL structure.

Then clears LEVEL allowing to reuse it.

Parameters:
lvl Pointer to the LEVEL structure.

Definition at line 1721 of file lev_data.c.

Referenced by user_load_map().

DLLIMPORT short free_text_file ( char ***  lines,
int *  lines_count 
)

Frees any text file loaded as lines.

Pointer value and lines count is cleared.

Parameters:
lines Pointer to the lines array.
lines_count Amount of allocated lines.
Returns:
Returns true on success, false on error.

Definition at line 1088 of file lev_data.c.

Referenced by load_lif().

DLLIMPORT void generate_random_map ( struct LEVEL lvl  ) 

Creates random level.

Requies the memory to be allocated by level_init(). Calls level_clear(), but not level_free() at start.

Parameters:
lvl Pointer to the LEVEL structure.

Definition at line 1698 of file lev_data.c.

DLLIMPORT void generate_slab_bkgnd_default ( struct LEVEL lvl,
unsigned short  def_slab 
)

Fills SLB/OWN structure with "default" background.

The default is unowned "def_slab" surrounded by rock. DAT/CLM values are not updated here.

Parameters:
lvl Pointer to the LEVEL structure.
def_slab Default slab.

Definition at line 1489 of file lev_data.c.

Referenced by start_new_map().

DLLIMPORT void generate_slab_bkgnd_random ( struct LEVEL lvl  ) 

Fills SLB/OWN structure with "random" background.

The resulting map is made of earth with random rock at borders. DAT/CLM values are not updated here.

Parameters:
lvl Pointer to the LEVEL structure.

Definition at line 1531 of file lev_data.c.

Referenced by generate_random_map().

DLLIMPORT char* get_actnpt ( const struct LEVEL lvl,
unsigned int  sx,
unsigned int  sy,
unsigned int  num 
)

Returns action point data for action point at given position.

Parameters:
lvl Pointer to the LEVEL structure.
sx,sy Subtile at which the action point is.
num Index of action point on the subtile.
Returns:
Returns the action point data, or NULL on error.

Definition at line 1883 of file lev_data.c.

Referenced by actnpts_verify(), create_actnpt_number_used_arr(), draw_things_on_buffer(), find_next_actnpt_on_map(), get_object(), and write_apt().

DLLIMPORT unsigned int get_actnpt_subnums ( const struct LEVEL lvl,
unsigned int  sx,
unsigned int  sy 
)

Gives amount of action points existing at given subtile.

Parameters:
lvl Pointer to the LEVEL structure.
sx,sy Subtile at which we're counting action points.
Returns:
Amount of action points on the subtile.

Definition at line 1970 of file lev_data.c.

Referenced by actnpt_add(), actnpt_del(), actnpts_verify(), create_actnpt_number_used_arr(), draw_things_on_buffer(), get_actnpt(), get_object(), get_object_subnums(), get_object_subtl_last(), get_object_type(), object_del(), and write_apt().

DLLIMPORT unsigned int get_apt_total_count ( struct LEVEL lvl  ) 

Returns total number of action points on the level.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns total number of action points.

Definition at line 2532 of file lev_data.c.

Referenced by get_level_objstats_textln().

DLLIMPORT unsigned int get_dat_val ( const struct LEVEL lvl,
const unsigned int  sx,
const unsigned int  sy 
)

Returns raw DAT value for one subtile.

Parameters:
lvl Pointer to the LEVEL structure.
sx,sy Map subtile at which we want the DAT value.
Returns:
Returns raw DAT value.

Definition at line 2384 of file lev_data.c.

Referenced by get_dat_subtile(), and write_dat().

DLLIMPORT char* get_data_path ( struct LEVEL lvl  ) 

Returns path to folder with data files.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns path text, or NULL on error.

Definition at line 2827 of file lev_data.c.

DLLIMPORT short get_datclm_auto_update ( struct LEVEL lvl  ) 

Returns state of the datclm_auto_update option for the level.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns state of datclm_auto_update.

Definition at line 2554 of file lev_data.c.

Referenced by user_set_owner_rect(), user_set_slab(), user_set_slab_rect(), user_set_slabown_rect(), and user_set_tile_owner().

DLLIMPORT short get_level_objstats_textln ( struct LEVEL lvl,
char *  stat_buf,
const int  line_num 
)

Formats object statistics text line.

Parameters:
lvl Pointer to the LEVEL structure.
stat_buf Destination text buffer.
line_num Line number to retrieve.
Returns:
Returns type of the line.

Definition at line 2989 of file lev_data.c.

DLLIMPORT char* get_levels_path ( struct LEVEL lvl  ) 

Returns path to folder with levels.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns path text, or NULL on error.

Definition at line 2791 of file lev_data.c.

DLLIMPORT unsigned int get_lgt_total_count ( struct LEVEL lvl  ) 

Returns total number of static lights on the level.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns total number of static lights.

Definition at line 2521 of file lev_data.c.

Referenced by get_level_objstats_textln().

DLLIMPORT char* get_lif_name_text ( struct LEVEL lvl  ) 

Returns text name of the level, from LIF file.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns text name of the level, or "" on error.

Definition at line 2740 of file lev_data.c.

Referenced by write_lif(), and write_nfo().

DLLIMPORT char* get_lvl_fname ( struct LEVEL lvl  ) 

Returns map file name for the level.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns map file name, or "" on error.

Definition at line 2671 of file lev_data.c.

DLLIMPORT short get_lvl_format_version ( struct LEVEL lvl  ) 

Returns level format version.

The format version was used when creating the LEVEL structure with level_init().

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns format version for the level.

Definition at line 2963 of file lev_data.c.

DLLIMPORT unsigned char get_lvl_inf ( struct LEVEL lvl  ) 

Returns INF entry (texture index) for the level.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns INF entry for the level.

Definition at line 2951 of file lev_data.c.

DLLIMPORT char* get_lvl_savfname ( struct LEVEL lvl  ) 

Returns save file name for the level.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns save file name, or "" on error.

Definition at line 2727 of file lev_data.c.

DLLIMPORT struct DK_SCRIPT* get_lvl_script ( struct LEVEL lvl  )  [read]

Returns pointer to the level script structure.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns pointer to DK_SCRIPT, or NULL on error.

Definition at line 2838 of file lev_data.c.

DLLIMPORT struct LEVSTATS* get_lvl_stats ( struct LEVEL lvl  )  [read]

Returns pointer to the level statistics structure.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns pointer to LEVSTATS, or NULL on error.

Definition at line 2849 of file lev_data.c.

Referenced by get_level_objstats_textln(), and user_save_map().

DLLIMPORT short get_obj_auto_update ( struct LEVEL lvl  ) 

Returns state of the obj_auto_update option for the level.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns state of obj_auto_update.

Definition at line 2591 of file lev_data.c.

Referenced by user_set_owner_rect(), user_set_slab(), user_set_slab_rect(), user_set_slabown_rect(), and user_set_tile_owner().

DLLIMPORT unsigned char* get_object ( const struct LEVEL lvl,
unsigned int  sx,
unsigned int  sy,
unsigned int  z 
)

Returns data for specific object at given position.

This function merges things, action points and static lights, treating them all just as 'objects'.

Parameters:
lvl Pointer to the LEVEL structure.
sx,sy Subtile at which the object is.
z Index of the object. Things have lowest indices, then comes action points and static lights.
Returns:
Returns the object data, or NULL on error.

Definition at line 2122 of file lev_data.c.

Referenced by get_nearest_object_idx().

DLLIMPORT unsigned int get_object_subnums ( const struct LEVEL lvl,
unsigned int  sx,
unsigned int  sy 
)

Gives amount of objects existing at given subtile.

This function merges things, action points and static lights, treating them all just as 'objects'.

Parameters:
lvl Pointer to the LEVEL structure.
sx,sy Subtile at which we're counting objects.
Returns:
Amount of objects on the subtile.

Definition at line 2187 of file lev_data.c.

Referenced by get_nearest_object_idx(), and get_object_subtl_last().

DLLIMPORT int get_object_subtl_last ( const struct LEVEL lvl,
unsigned int  sx,
unsigned int  sy,
short  obj_type 
)

Gives index of the last object with given type.

Parameters:
lvl Pointer to the LEVEL structure.
sx,sy Subtile at which the object is.
obj_type Type of the object, one of OBJECT_TYPE_* values.
Returns:
Returns index of the last object with given type. May return -1 if no object found.

Definition at line 2220 of file lev_data.c.

DLLIMPORT unsigned int get_object_tilnums ( const struct LEVEL lvl,
unsigned int  tx,
unsigned int  ty 
)

Gives amount of objects existing at given tile.

This function merges things, action points and static lights, treating them all just as 'objects'.

Parameters:
lvl Pointer to the LEVEL structure.
tx,ty Tile at which we're counting objects.
Returns:
Amount of objects on the tile.

Definition at line 2206 of file lev_data.c.

DLLIMPORT short get_object_type ( const struct LEVEL lvl,
unsigned int  sx,
unsigned int  sy,
unsigned int  z 
)

Checks what type the object is.

Objects are action points, things or lights. This function merges things, action points and static lights, treating them all just as 'objects'.

Parameters:
lvl Pointer to the LEVEL structure.
sx,sy Subtile at which the object is.
z Index of the object. Things have lowest indices, then comes action points and static lights.
Returns:
Returns one of OBJECT_TYPE_* value.

Definition at line 2095 of file lev_data.c.

Referenced by get_nearest_object_idx().

DLLIMPORT char* get_stlight ( const struct LEVEL lvl,
unsigned int  sx,
unsigned int  sy,
unsigned int  num 
)

Returns static light data for light at given position.

Parameters:
lvl Pointer to the LEVEL structure.
sx,sy Subtile at which the static light is.
num Index of static light on the subtile.
Returns:
Returns the static light data, or NULL on error.

Definition at line 1988 of file lev_data.c.

Referenced by draw_things_on_buffer(), find_next_stlight_on_map(), get_object(), and write_lgt().

DLLIMPORT unsigned int get_stlight_subnums ( const struct LEVEL lvl,
unsigned int  sx,
unsigned int  sy 
)

Gives amount of static lights existing at given subtile.

Parameters:
lvl Pointer to the LEVEL structure.
sx,sy Subtile at which we're counting static lights.
Returns:
Amount of static lights on the subtile.

Definition at line 2074 of file lev_data.c.

Referenced by draw_things_on_buffer(), remove_automade_obj_for_slab(), and write_lgt().

DLLIMPORT unsigned short get_subtl_flg ( struct LEVEL lvl,
unsigned int  sx,
unsigned int  sy 
)

Returns FLG value for one subtile.

Parameters:
lvl Pointer to the LEVEL structure.
sx,sy Map subtile at which we want the FLG value.
Returns:
Returns FLG value.

Definition at line 2411 of file lev_data.c.

Referenced by write_flg().

DLLIMPORT unsigned char get_subtl_owner ( const struct LEVEL lvl,
unsigned int  sx,
unsigned int  sy 
)

Gives owner (OWN value) for a subtile.

Parameters:
lvl Pointer to the LEVEL structure.
sx,sy Map subtile at which we want the owner value.
Returns:
Returns subtile owner index.

Definition at line 2302 of file lev_data.c.

Referenced by draw_map_on_buffer(), get_tile_owner(), and write_own().

DLLIMPORT short get_subtl_wib ( struct LEVEL lvl,
unsigned int  sx,
unsigned int  sy 
)

Gives WIBble value for a subtile.

Parameters:
lvl Pointer to the LEVEL structure.
sx,sy Map subtile at which we want the WIB value.
Returns:
Returns WIB value.

Definition at line 2247 of file lev_data.c.

Referenced by write_wib().

DLLIMPORT char* get_thing ( const struct LEVEL lvl,
unsigned int  sx,
unsigned int  sy,
unsigned int  num 
)

DLLIMPORT unsigned int get_thing_subnums ( const struct LEVEL lvl,
unsigned int  sx,
unsigned int  sy 
)

DLLIMPORT unsigned char get_tile_owner ( const struct LEVEL lvl,
unsigned int  tx,
unsigned int  ty 
)

Gives owner (OWN value) for a tile.

Parameters:
lvl Pointer to the LEVEL structure.
tx,ty Map tile at which we want the owner value.
Returns:
Returns owner index for subtile at centre of given tile.

Definition at line 2329 of file lev_data.c.

Referenced by create_creature(), create_door(), create_doorkey(), create_effectgen(), create_item(), create_torch(), create_trap(), get_slab_surround(), slab_is_central(), update_thing_slb_room_one_central_item(), update_thing_slb_room_one_item_subtl(), update_things_slb_barracks_corner(), update_things_slb_graveyard_corner(), update_things_slb_portal_inside(), and update_tile_flg_entries().

DLLIMPORT unsigned short get_tile_slab ( const struct LEVEL lvl,
unsigned int  tx,
unsigned int  ty 
)

DLLIMPORT short get_tile_wlb ( struct LEVEL lvl,
unsigned int  tx,
unsigned int  ty 
)

Gives WLB (Water-Lava Block) value for a tile.

Parameters:
lvl Pointer to the LEVEL structure.
tx,ty Map tile at which we want the WLB value.
Returns:
Returns WLB value.

Definition at line 2275 of file lev_data.c.

Referenced by update_tile_wlb_entry().

DLLIMPORT unsigned int get_tng_total_count ( struct LEVEL lvl  ) 

Returns total number of things on the level.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns total number of things.

Definition at line 2543 of file lev_data.c.

Referenced by get_level_objstats_textln().

DLLIMPORT unsigned long inc_info_usr_cmds_count ( struct LEVEL lvl  ) 

Increases total user commands counter.

Used for user commands statistics for the level.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns the current user commands count.

Definition at line 2887 of file lev_data.c.

DLLIMPORT unsigned long inc_info_usr_creatobj_count ( struct LEVEL lvl  ) 

Increases user objects created counter.

Used for user commands statistics for the level.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns the current objects created count.

Definition at line 2900 of file lev_data.c.

DLLIMPORT unsigned long inc_info_usr_mdswtch_count ( struct LEVEL lvl  ) 

Increases mode switches counter.

Used for user commands statistics for the level.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns the current mode switches count.

Definition at line 2861 of file lev_data.c.

DLLIMPORT unsigned long inc_info_usr_slbchng_count ( struct LEVEL lvl  ) 

Increases SLB changes counter.

Used for user commands statistics for the level.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns the current SLB changes count.

Definition at line 2874 of file lev_data.c.

Referenced by user_set_owner_rect(), user_set_slab(), user_set_slab_rect(), user_set_slabown_rect(), and user_set_tile_owner().

DLLIMPORT unsigned int inc_info_ver_major ( struct LEVEL lvl  ) 

Increases major version number for the level.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns the current major version number.

Definition at line 2912 of file lev_data.c.

Referenced by user_save_map().

DLLIMPORT unsigned int inc_info_ver_minor ( struct LEVEL lvl  ) 

Increases minor version number for the level.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns the current minor version number.

Definition at line 2926 of file lev_data.c.

Referenced by user_save_map().

DLLIMPORT unsigned int inc_info_ver_rel ( struct LEVEL lvl  ) 

Increases version release number for the level.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns the current version release number.

Definition at line 2939 of file lev_data.c.

Referenced by user_save_map().

DLLIMPORT short level_clear ( struct LEVEL lvl  ) 

Clears the whole object for storing level.

Drops any old pointers without deallocating them. Requies level_init() to be run first. Leaves only optns struct unaffected.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns true on success, false on error.

Definition at line 790 of file lev_data.c.

Referenced by free_map(), generate_random_map(), level_init(), load_dk1_map(), load_dke_map(), load_map_preview(), and start_new_map().

short level_clear_apt ( struct LEVEL lvl  ) 

clears the "actions" structure for storing level.

Drops any old pointers without deallocating them. Requies level_init() to be run first.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns true on success, false on failure.

Definition at line 487 of file lev_data.c.

Referenced by level_clear().

short level_clear_datclm ( struct LEVEL lvl  ) 

Clears the "column" structure for storing level.

Will not drop any pointers. Requies level_init() to be run first.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns true on success, false on failure.

Definition at line 535 of file lev_data.c.

Referenced by level_clear(), and update_datclm_for_whole_map().

short level_clear_info ( struct LEVEL lvl  ) 

Clears (sets for new map) info for given level.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns true on success, false on failure.

Definition at line 617 of file lev_data.c.

Referenced by level_clear().

short level_clear_lgt ( struct LEVEL lvl  ) 

clears the "lights" structure for storing level.

Drops any old pointers without deallocating them. Requies level_init() to be run first.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns true on success, false on failure.

Definition at line 511 of file lev_data.c.

Referenced by level_clear().

DLLIMPORT short level_clear_options ( struct LEVOPTIONS optns  ) 

Clears options for given level.

This one is not executed when clearing the level, only when making new one.

Parameters:
optns The LEVOPTIONS structure to clear.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 380 of file lev_data.c.

Referenced by level_init().

short level_clear_other ( struct LEVEL lvl  ) 

Clears minor LEVEL substructures.

Clears the structures for storing level which do not have separate clearing function. Drops any old pointers without deallocating them, only file name remains. Requies level_init() to be run first.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns true on success, false on error.

Definition at line 723 of file lev_data.c.

Referenced by level_clear().

short level_clear_script ( struct LEVEL lvl  ) 

Clears (via zeroing) TXT script info for given level.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns true on success, false on failure.

Definition at line 647 of file lev_data.c.

Referenced by level_clear().

DLLIMPORT short level_clear_script_param ( struct DK_SCRIPT_PARAMETERS par  ) 

Clears (via zeroing) given script parameters struct.

Parameters:
par Pointer to the DK_SCRIPT_PARAMETERS structure.
Returns:
Returns true on success, false on failure.

Definition at line 662 of file lev_data.c.

Referenced by level_clear_script(), and script_decomposed_to_params().

short level_clear_stats ( struct LEVEL lvl  ) 

Clears (via zeroing) stats for given level.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns true on success, false on failure.

Definition at line 587 of file lev_data.c.

Referenced by level_clear(), and update_things_stats().

short level_clear_tng ( struct LEVEL lvl  ) 

Clears the "things" structure for storing level.

Drops any old pointers without deallocating them. Requies level_init() to be run first.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns true on success, false on failure.

Definition at line 457 of file lev_data.c.

Referenced by level_clear().

DLLIMPORT short level_deinit ( struct LEVEL **  lvl_ptr  ) 

Frees structures for storing level.

Frees only the memory allocated by level_init(); to free the content of loaded level, you must call level_free() first.

See also:
level_free
Parameters:
lvl_ptr Double pointer to the LEVEL structure.
Returns:
Returns true on success, false on error.

Definition at line 842 of file lev_data.c.

DLLIMPORT short level_free ( struct LEVEL lvl  ) 

Frees structures for storing level.

Frees only data pointers, the array structure remains intact (as after level_init(), but values are not cleared - use level_clear() to set NULLs to pointers).

See also:
level_clear
Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns true on success, false on error.

Definition at line 1139 of file lev_data.c.

Referenced by free_map(), load_dk1_map(), load_dke_map(), and load_map_preview().

DLLIMPORT short level_free_script_param ( struct DK_SCRIPT_PARAMETERS par  ) 

Frees all sub-structures of given DK_SCRIPT_PARAMETERS.

Parameters:
par Pointer to the DK_SCRIPT_PARAMETERS structure.
Returns:
Returns true on success, false on error.

Definition at line 811 of file lev_data.c.

Referenced by level_deinit().

short level_free_tng ( struct LEVEL lvl  ) 

Frees "things" structure for storing level.

Disposes only data pointers, the array structure remains intact (as after level_init(), but values are not cleared).

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns true on success, false on error.

Definition at line 1008 of file lev_data.c.

Referenced by level_free().

DLLIMPORT short level_generate_random_extension ( struct LEVEL lvl,
char *  ret_msg 
)

Adds random extension to the level.

Parameters:
lvl Pointer to the LEVEL structure.
ret_msg Text message returned by function.
Todo:
This one is unfinished.

Definition at line 1733 of file lev_data.c.

DLLIMPORT struct MAPDRAW_OPTIONS* level_get_mapdraw_options ( struct LEVEL lvl  )  [read]

Gets the map drawing options for the LEVEL structure.

Returns direct pointer to the structure.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns MAPDRAW_OPTIONS structure from the level.

Definition at line 446 of file lev_data.c.

DLLIMPORT struct LEVOPTIONS* level_get_options ( struct LEVEL lvl  )  [read]

Gets all options for the LEVEL structure.

Returns direct pointer to the structure.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns LEVOPTIONS structure.

Definition at line 420 of file lev_data.c.

DLLIMPORT struct DK_SCRIPT_PARAMETERS* level_get_script_param ( struct LEVEL lvl  )  [read]

Returns DK_SCRIPT_PARAMETERS struct for given level.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns pointer to DK_SCRIPT_PARAMETERS, or NULL on error.

Definition at line 1157 of file lev_data.c.

DLLIMPORT short level_init ( struct LEVEL **  lvl_ptr,
short  map_version,
struct UPOINT_3D lvl_size 
)

Creates object for storing one level.

Allocates memory and inits the values to zero; drops any previous pointers without deallocating.

Parameters:
lvl_ptr Double pointer to the new level structure.
map_version Map version constant, from MAP_FORMAT_VERSION enumeration.
lvl_size Level size struct.This can be NULL if map_version does not support multiple sizes of maps.
Returns:
Returns false on error, true on success.

Definition at line 53 of file lev_data.c.

DLLIMPORT short level_set_mapdraw_options ( struct LEVEL lvl,
struct MAPDRAW_OPTIONS mdrwopts 
)

Sets the map drawing options for the LEVEL structure from another MAPDRAW_OPTIONS.

Copies the whole MAPDRAW_OPTIONS structure into the one in LEVEL. Keeps only previous value of data_path.

Parameters:
lvl Pointer to the LEVEL structure.
mdrwopts The MAPDRAW_OPTIONS structure to copy from.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 433 of file lev_data.c.

DLLIMPORT short level_set_options ( struct LEVEL lvl,
struct LEVOPTIONS optns 
)

Sets all options for the LEVEL structure from another LEVOPTIONS.

Copies the whole LEVOPTIONS structure into the one in LEVEL.

Parameters:
lvl Pointer to the LEVEL structure.
optns The LEVOPTIONS structure to copy from.
Returns:
Returns ERR_NONE on success, error code on failure.

Definition at line 407 of file lev_data.c.

DLLIMPORT short level_verify ( struct LEVEL lvl,
char *  actn_name,
struct IPOINT_2D errpt 
)

Verifies the whole level.

On error adds description message to the error messages log.

Parameters:
lvl Pointer to the LEVEL structure.
actn_name Name of the action which invoked verification.
errpt Coordinates of the map tile containing the error.
Returns:
Returns VERIF_ERROR, VERIF_WARN or VERIF_OK. If a problem was found, adds error message and sets errpt accordingly.

Definition at line 1173 of file lev_data.c.

Referenced by user_save_map().

DLLIMPORT short level_verify_logic ( struct LEVEL lvl,
char *  err_msg,
struct IPOINT_2D errpt 
)

Verifies various logic aspects of a map.

Parameters:
lvl Pointer to the LEVEL structure.
err_msg Error message output buffer.
errpt Coordinates of the map tile containing the error.
Returns:
Returns VERIF_ERROR, VERIF_WARN or VERIF_OK. If a problem was found, sets err_msg and errpt accordingly.

Definition at line 1402 of file lev_data.c.

Referenced by level_verify().

DLLIMPORT short level_verify_struct ( struct LEVEL lvl,
char *  err_msg,
struct IPOINT_2D errpt 
)

Verifies internal LEVEL structure integrity.

Parameters:
lvl Pointer to the LEVEL structure.
err_msg Error message output buffer.
errpt Coordinates of the map tile containing the error.
Returns:
Returns VERIF_ERROR, VERIF_WARN or VERIF_OK. If a problem was found, sets err_msg and errpt accordingly.

Definition at line 1247 of file lev_data.c.

Referenced by level_verify().

DLLIMPORT void object_del ( struct LEVEL lvl,
unsigned int  sx,
unsigned int  sy,
unsigned int  z 
)

Deletes object with given coordinates and index.

This function merges things, action points and static lights, treating them all just as 'objects'.

Parameters:
lvl Pointer to the LEVEL structure.
sx,sy Subtile at which the object is.
z Index of the object. Things have lowest indices, then comes action points and static lights.

Definition at line 2151 of file lev_data.c.

DLLIMPORT void set_dat_val ( struct LEVEL lvl,
int  sx,
int  sy,
unsigned int  d 
)

Sets a DAT value for one subtile.

Low level - sets the RAW value, not column index.

Parameters:
lvl Pointer to the LEVEL structure.
sx,sy Map subtile at which we want to set DAT value.
d Raw DAT value to set.

Definition at line 2398 of file lev_data.c.

Referenced by load_dat(), and set_dat_subtile().

DLLIMPORT short set_data_path ( struct LEVEL lvl,
char *  datpath 
)

Sets path at which data files are.

The path should be without ending slash, and will be used only for graphics related commands.

Parameters:
lvl Pointer to the LEVEL structure.
datpath The new path for data files folder.
Returns:
Returns true on success, false on error.

Definition at line 2804 of file lev_data.c.

DLLIMPORT short set_datclm_auto_update ( struct LEVEL lvl,
short  val 
)

Sets state of the datclm_auto_update option for the level.

Parameters:
lvl Pointer to the LEVEL structure.
val New state of the option.
Returns:
Returns true if datclm_auto_update was successfully changed.

Definition at line 2579 of file lev_data.c.

DLLIMPORT short set_levels_path ( struct LEVEL lvl,
char *  lvpath 
)

Sets path at which maps are.

The path should be without ending slash, and will be used only if map name to load/save doesn't have its own path.

Parameters:
lvl Pointer to the LEVEL structure.
lvpath The new path for levels folder.
Returns:
Returns true on success, false on error.

Definition at line 2770 of file lev_data.c.

DLLIMPORT short set_lif_name_text ( struct LEVEL lvl,
char *  name 
)

Sets text name of the level, from LIF file.

Directly sets the name pointer, without duplicating it.

Parameters:
lvl Pointer to the LEVEL structure.
name New text name of the level.
Returns:
Returns true on success, false on error.

Definition at line 2755 of file lev_data.c.

Referenced by execute_adikted_command(), load_lif(), and load_slb().

DLLIMPORT short set_lvl_fname ( struct LEVEL lvl,
char *  fname 
)

Sets map file name for the level.

Parameters:
lvl Pointer to the LEVEL structure.
fname The new file name, which is copied to the level.
Returns:
Returns true on success, false on error.

Definition at line 2629 of file lev_data.c.

DLLIMPORT short set_lvl_inf ( struct LEVEL lvl,
unsigned char  ninf 
)

Sets INF entry (texture index) for the level.

Parameters:
lvl Pointer to the LEVEL structure.
ninf New INF entry for the level.
Returns:
Returns true on success, false on error.

Definition at line 2975 of file lev_data.c.

DLLIMPORT short set_lvl_savfname ( struct LEVEL lvl,
char *  fname 
)

Sets map file name for saving the level.

Parameters:
lvl Pointer to the LEVEL structure.
fname The new file name to save on.
Returns:
Returns true on success, false on error.

Definition at line 2685 of file lev_data.c.

DLLIMPORT short set_obj_auto_update ( struct LEVEL lvl,
short  val 
)

Sets state of the obj_auto_update option for the level.

Parameters:
lvl Pointer to the LEVEL structure.
val New state of the option.
Returns:
Returns true if obj_auto_update was successfully changed.

Definition at line 2616 of file lev_data.c.

DLLIMPORT void set_subtl_flg ( struct LEVEL lvl,
unsigned int  sx,
unsigned int  sy,
unsigned short  nval 
)

Sets a FLG value for one subtile.

Parameters:
lvl Pointer to the LEVEL structure.
sx,sy Map subtile at which we want to set FLG value.
nval FLG value to set.

Definition at line 2424 of file lev_data.c.

Referenced by load_flg(), and update_tile_flg_entries().

DLLIMPORT void set_subtl_owner ( struct LEVEL lvl,
unsigned int  sx,
unsigned int  sy,
unsigned char  nval 
)

Sets owner (OWN value) for a subtile.

Parameters:
lvl Pointer to the LEVEL structure.
sx,sy Map subtile at which we want to set owner value.
nval New value for the subtile owner.

Definition at line 2316 of file lev_data.c.

Referenced by generate_slab_bkgnd_default(), generate_slab_bkgnd_random(), load_own(), set_tile_owner(), and update_slab_owners().

DLLIMPORT void set_subtl_wib ( struct LEVEL lvl,
unsigned int  sx,
unsigned int  sy,
short  nval 
)

Sets WIBble value for a subtile.

Parameters:
lvl Pointer to the LEVEL structure.
sx,sy Map subtile at which we want to set WIB value.
nval New value for the subtile wibble.

Definition at line 2261 of file lev_data.c.

Referenced by load_wib(), and update_tile_wib_entries().

DLLIMPORT void set_tile_owner ( struct LEVEL lvl,
unsigned int  tx,
unsigned int  ty,
unsigned char  nval 
)

Sets owner (OWN value) for a tile.

Sets given owner value for all subtiles on given tile.

Parameters:
lvl Pointer to the LEVEL structure.
tx,ty Map tile at which we want to set owner value.
nval New value for the tile owner.

Definition at line 2341 of file lev_data.c.

Referenced by generate_slab_bkgnd_default(), generate_slab_bkgnd_random(), update_slab_owners(), user_set_owner_rect(), user_set_slabown_rect(), and user_set_tile_owner().

DLLIMPORT void set_tile_slab ( struct LEVEL lvl,
unsigned int  tx,
unsigned int  ty,
unsigned short  nval 
)

Sets a new value to SLB item, without updating DAT or CLM or anything.

To update level graphics after putting slab, use user_set_slab() instead.

See also:
user_set_slab
Parameters:
lvl Pointer to the LEVEL structure.
tx,ty Map tile at which we want to set slab value.
nval New value for the tile slab.

Definition at line 2371 of file lev_data.c.

Referenced by generate_slab_bkgnd_default(), generate_slab_bkgnd_random(), load_slb(), slab_draw_circle(), user_set_slab(), user_set_slab_rect(), and user_set_slabown_rect().

DLLIMPORT void set_tile_wlb ( struct LEVEL lvl,
unsigned int  tx,
unsigned int  ty,
short  nval 
)

Sets WLB (Water-Lava Block) value for a tile.

Parameters:
lvl Pointer to the LEVEL structure.
tx,ty Map tile at which we want to set WLB value.
nval New value for the tile WLB.

Definition at line 2289 of file lev_data.c.

Referenced by update_tile_wlb_entry().

DLLIMPORT void start_new_map ( struct LEVEL lvl  ) 

Creates new level.

Requies the memory to be allocated by level_init(). Calls level_clear(), but not level_free() at start.

Parameters:
lvl Pointer to the LEVEL structure.

Definition at line 1668 of file lev_data.c.

Referenced by user_load_map().

DLLIMPORT int stlight_add ( struct LEVEL lvl,
unsigned char *  stlight 
)

Adds a given static light to the LEVEL structure.

Updates counter variables.

Parameters:
lvl Pointer to the LEVEL structure.
stlight Pointer to the static light data to add.
Returns:
Returns the index at which static light is added, or -1 on error.

Definition at line 2008 of file lev_data.c.

Referenced by load_lgt().

DLLIMPORT void stlight_del ( struct LEVEL lvl,
unsigned int  sx,
unsigned int  sy,
unsigned int  num 
)

Removes given static light from the LEVEL structure.

Updates counter variables. Also frees memory allocated for the static light.

Parameters:
lvl Pointer to the LEVEL structure.
sx,sy Subtile at which the static light is.
num Index of static light on the subtile.

Definition at line 2044 of file lev_data.c.

Referenced by level_free_lgt(), object_del(), and remove_automade_obj_for_slab().

DLLIMPORT short switch_datclm_auto_update ( struct LEVEL lvl  ) 

Switches state of the datclm_auto_update option for the level.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns new state of datclm_auto_update.

Definition at line 2565 of file lev_data.c.

DLLIMPORT short switch_obj_auto_update ( struct LEVEL lvl  ) 

Switches state of the obj_auto_update option for the level.

Parameters:
lvl Pointer to the LEVEL structure.
Returns:
Returns new state of obj_auto_update.

Definition at line 2602 of file lev_data.c.

DLLIMPORT int thing_add ( struct LEVEL lvl,
unsigned char *  thing 
)

Adds a thing to the structure and returns its index.

Also updates statistics.

Parameters:
lvl Pointer to the LEVEL structure.
thing Pointer to the thing data to add.
Returns:
Returns the index at which thing is added, or -1 on error.

Definition at line 1782 of file lev_data.c.

Referenced by load_tng(), set_door_lock(), update_door_things_on_slab(), update_thing_slb_room_one_central_item(), update_thing_slb_room_one_item_subtl(), update_things_slb_barracks_corner(), update_things_slb_graveyard_corner(), and update_things_slb_portal_inside().

DLLIMPORT void thing_del ( struct LEVEL lvl,
unsigned int  sx,
unsigned int  sy,
unsigned int  num 
)

Removes given thing from the LEVEL structure, updates counter variables.

Also frees memory allocated for the thing.

Parameters:
lvl Pointer to the LEVEL structure.
sx,sy Subtile at which the thing is.
num Index of thing on the subtile.

Definition at line 1817 of file lev_data.c.

Referenced by delete_room_things_subtl(), level_free_tng(), object_del(), remove_automade_obj_for_slab(), remove_misplaced_objs_on_slab(), remove_noncrucial_room_things(), set_door_lock(), update_door_things_on_slab(), update_thing_slb_room_one_central_item(), update_thing_slb_room_one_item_subtl(), update_things_slb_barracks_corner(), update_things_slb_graveyard_corner(), and update_things_slb_portal_inside().

DLLIMPORT void thing_drop ( struct LEVEL lvl,
unsigned int  sx,
unsigned int  sy,
unsigned int  num 
)

Removes given thing from the LEVEL structure, updates counter variables.

Does not frees memory allocated for the thing - just drops the pointers. Updates thing statistics.

Parameters:
lvl Pointer to the LEVEL structure.
sx,sy Subtile at which the thing is.
num Index of thing on the subtile.

Definition at line 1838 of file lev_data.c.

Referenced by thing_del(), and update_door_things_on_slab().

DLLIMPORT void update_level_stats ( struct LEVEL lvl  ) 

Updates some statistics about the level.

The update includes "utilize" values of columns.

Parameters:
lvl Pointer to the LEVEL structure.

Definition at line 2436 of file lev_data.c.

Referenced by generate_random_map(), load_map_preview(), start_new_map(), and user_load_map().

DLLIMPORT void update_object_owners ( struct LEVEL lvl  ) 

DLLIMPORT void update_thing_stats ( struct LEVEL lvl,
const unsigned char *  thing,
short  change 
)

Updates statistics about the thing.

Parameters:
lvl Pointer to the LEVEL structure.
thing Pointer to the thing data.
change How the amount of such things have changes. Positive if the thing was added, negative if removed.

Definition at line 2477 of file lev_data.c.

Referenced by thing_add(), thing_drop(), and update_things_stats().

DLLIMPORT void update_things_stats ( struct LEVEL lvl  ) 

Updates statistics about the level.

Does not updates "utilize" values of columns.

Parameters:
lvl Pointer to the LEVEL structure.

Definition at line 2447 of file lev_data.c.

Referenced by update_level_stats().

DLLIMPORT short user_set_owner_rect ( struct LEVEL lvl,
unsigned int  startx,
unsigned int  endx,
unsigned int  starty,
unsigned int  endy,
unsigned short  nown 
)

Changes owner of a map rectangle.

Updates level graphics, things and statistics.

Parameters:
lvl Pointer to the LEVEL structure.
startx,starty Top left of the changed rectangle.
endx,endy Bottom right of the changed rectangle.
nown New value for the rectangle owner.
Returns:
Returns true on success, false on error.

Definition at line 3197 of file lev_data.c.

DLLIMPORT short user_set_slab ( struct LEVEL lvl,
unsigned int  tx,
unsigned int  ty,
unsigned short  nslab 
)

Puts a new slab on map.

Updates level graphics, things and statistics.

See also:
set_tile_slab
Parameters:
lvl Pointer to the LEVEL structure.
tx,ty Map coordinates of the slab to change.
nslab New value for the tile slab.
Returns:
Returns true on success, false on error.

Definition at line 3113 of file lev_data.c.

DLLIMPORT short user_set_slab_rect ( struct LEVEL lvl,
unsigned int  startx,
unsigned int  endx,
unsigned int  starty,
unsigned int  endy,
unsigned short  nslab 
)

Puts a rectangle of new slabs on map.

Updates level graphics, things and statistics.

Parameters:
lvl Pointer to the LEVEL structure.
startx,starty Top left of the changed rectangle.
endx,endy Bottom right of the changed rectangle.
nslab New value for the slab to fill rectangle.
Returns:
Returns true on success, false on error.

Definition at line 3161 of file lev_data.c.

DLLIMPORT short user_set_slabown_rect ( struct LEVEL lvl,
unsigned int  startx,
unsigned int  endx,
unsigned int  starty,
unsigned int  endy,
unsigned short  nslab,
unsigned short  nown 
)

Puts a rectangle of new slabs on map.

Updates level graphics, things and statistics.

Parameters:
lvl Pointer to the LEVEL structure.
startx,starty Top left of the changed rectangle.
endx,endy Bottom right of the changed rectangle.
nslab New value for the slab to put in rectangle.
nown New value for the rectangle owner.
Returns:
Returns true on success, false on error.

Definition at line 3232 of file lev_data.c.

DLLIMPORT short user_set_tile_owner ( struct LEVEL lvl,
unsigned int  tx,
unsigned int  ty,
unsigned short  nown 
)

Changes owner of one slab on map.

Updates level graphics, things and statistics.

See also:
set_tile_owner
Parameters:
lvl Pointer to the LEVEL structure.
tx,ty Map coordinates of the owner to change.
nown New value for the tile owner.
Returns:
Returns true on success, false on error.

Definition at line 3137 of file lev_data.c.


Variable Documentation

const char default_map_name[]

Definition at line 42 of file lev_data.c.

Referenced by level_clear_info(), and load_slb().

const int idir_subtl_x[]

const int idir_subtl_y[]


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