Definition in file lev_data.c.
#include "lev_data.h"
#include <math.h>
#include <time.h>
#include "globals.h"
#include "obj_column_def.h"
#include "obj_slabs.h"
#include "obj_things.h"
#include "obj_column.h"
#include "lev_script.h"
#include "draw_map.h"
Go to the source code of this file.
Functions | |
short | level_init (struct LEVEL **lvl_ptr, short map_version, struct UPOINT_3D *lvl_size) |
Creates object for storing one level. | |
short | level_set_size (struct LEVEL *lvl, struct UPOINT_3D *lvl_size) |
Resizes arrays in object for storing level. | |
short | level_clear_options (struct LEVOPTIONS *optns) |
Clears options for given level. | |
short | level_set_options (struct LEVEL *lvl, struct LEVOPTIONS *optns) |
Sets all options for the LEVEL structure from another LEVOPTIONS. | |
struct LEVOPTIONS * | level_get_options (struct LEVEL *lvl) |
Gets all options for the LEVEL structure. | |
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. | |
struct MAPDRAW_OPTIONS * | level_get_mapdraw_options (struct LEVEL *lvl) |
Gets the map drawing options for the LEVEL structure. | |
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_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. | |
short | level_clear_script_param (struct DK_SCRIPT_PARAMETERS *par) |
Clears (via zeroing) given script parameters struct. | |
short | level_clear_other (struct LEVEL *lvl) |
Clears minor LEVEL substructures. | |
short | level_clear (struct LEVEL *lvl) |
Clears the whole object for storing level. | |
short | level_free_script_param (struct DK_SCRIPT_PARAMETERS *par) |
Frees all sub-structures of given DK_SCRIPT_PARAMETERS. | |
short | level_deinit (struct LEVEL **lvl_ptr) |
Frees structures for storing level. | |
short | level_free_tng (struct LEVEL *lvl) |
Frees "things" structure for storing level. | |
short | level_free_apt (struct LEVEL *lvl) |
Frees "action points" structure for storing level. | |
short | level_free_txt (struct LEVEL *lvl) |
Frees TXT structure for storing level script. | |
short | free_text_file (char ***lines, int *lines_count) |
Frees any text file loaded as lines. | |
short | level_free_lgt (struct LEVEL *lvl) |
Frees LGT structure for storing level lights. | |
short | level_free (struct LEVEL *lvl) |
Frees structures for storing level. | |
struct DK_SCRIPT_PARAMETERS * | level_get_script_param (struct LEVEL *lvl) |
Returns DK_SCRIPT_PARAMETERS struct for given level. | |
short | level_verify (struct LEVEL *lvl, char *actn_name, struct IPOINT_2D *errpt) |
Verifies the whole level. | |
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. | |
short | level_verify_logic (struct LEVEL *lvl, char *err_msg, struct IPOINT_2D *errpt) |
Verifies various logic aspects of a map. | |
void | generate_slab_bkgnd_default (struct LEVEL *lvl, unsigned short def_slab) |
Fills SLB/OWN structure with "default" background. | |
void | generate_slab_bkgnd_random (struct LEVEL *lvl) |
Fills SLB/OWN structure with "random" background. | |
void | start_new_map (struct LEVEL *lvl) |
Creates new level. | |
void | generate_random_map (struct LEVEL *lvl) |
Creates random level. | |
void | free_map (struct LEVEL *lvl) |
Frees the level data stored in LEVEL structure. | |
short | level_generate_random_extension (struct LEVEL *lvl, char *ret_msg) |
Adds random extension to the level. | |
char * | get_thing (const struct LEVEL *lvl, unsigned int sx, unsigned int sy, unsigned int num) |
Returns thing data for thing at given position. | |
int | thing_add (struct LEVEL *lvl, unsigned char *thing) |
Adds a thing to the structure and returns its index. | |
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. | |
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. | |
unsigned int | get_thing_subnums (const struct LEVEL *lvl, unsigned int sx, unsigned int sy) |
Gives amount of things existing at given subtile. | |
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. | |
int | actnpt_add (struct LEVEL *lvl, unsigned char *actnpt) |
Adds a given action point to the LEVEL structure. | |
void | actnpt_del (struct LEVEL *lvl, unsigned int sx, unsigned int sy, unsigned int num) |
Removes given action point from the LEVEL structure. | |
unsigned int | get_actnpt_subnums (const struct LEVEL *lvl, unsigned int sx, unsigned int sy) |
Gives amount of action points existing at given subtile. | |
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. | |
int | stlight_add (struct LEVEL *lvl, unsigned char *stlight) |
Adds a given static light to the LEVEL structure. | |
void | stlight_del (struct LEVEL *lvl, unsigned int sx, unsigned int sy, unsigned int num) |
Removes given static light from the LEVEL structure. | |
unsigned int | get_stlight_subnums (const struct LEVEL *lvl, unsigned int sx, unsigned int sy) |
Gives amount of static lights existing at given subtile. | |
short | get_object_type (const struct LEVEL *lvl, unsigned int sx, unsigned int sy, unsigned int z) |
Checks what type the object is. | |
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. | |
void | object_del (struct LEVEL *lvl, unsigned int sx, unsigned int sy, unsigned int z) |
Deletes object with given coordinates and index. | |
unsigned int | get_object_subnums (const struct LEVEL *lvl, unsigned int sx, unsigned int sy) |
Gives amount of objects existing at given subtile. | |
unsigned int | get_object_tilnums (const struct LEVEL *lvl, unsigned int tx, unsigned int ty) |
Gives amount of objects existing at given tile. | |
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. | |
short | get_subtl_wib (struct LEVEL *lvl, unsigned int sx, unsigned int sy) |
Gives WIBble value for a subtile. | |
void | set_subtl_wib (struct LEVEL *lvl, unsigned int sx, unsigned int sy, short nval) |
Sets WIBble value for a subtile. | |
short | get_tile_wlb (struct LEVEL *lvl, unsigned int tx, unsigned int ty) |
Gives WLB (Water-Lava Block) value for a tile. | |
void | set_tile_wlb (struct LEVEL *lvl, unsigned int tx, unsigned int ty, short nval) |
Sets WLB (Water-Lava Block) value for a tile. | |
unsigned char | get_subtl_owner (const struct LEVEL *lvl, unsigned int sx, unsigned int sy) |
Gives owner (OWN value) for a subtile. | |
void | set_subtl_owner (struct LEVEL *lvl, unsigned int sx, unsigned int sy, unsigned char nval) |
Sets owner (OWN value) for a subtile. | |
unsigned char | get_tile_owner (const struct LEVEL *lvl, unsigned int tx, unsigned int ty) |
Gives owner (OWN value) for a tile. | |
void | set_tile_owner (struct LEVEL *lvl, unsigned int tx, unsigned int ty, unsigned char nval) |
Sets owner (OWN value) for a tile. | |
unsigned short | get_tile_slab (const struct LEVEL *lvl, unsigned int tx, unsigned int ty) |
Gives slab (SLB value) for a tile. | |
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. | |
unsigned int | get_dat_val (const struct LEVEL *lvl, const unsigned int sx, const unsigned int sy) |
Returns raw DAT value for one subtile. | |
void | set_dat_val (struct LEVEL *lvl, int sx, int sy, unsigned int d) |
Sets a DAT value for one subtile. | |
unsigned short | get_subtl_flg (struct LEVEL *lvl, unsigned int sx, unsigned int sy) |
Returns FLG value for one subtile. | |
void | set_subtl_flg (struct LEVEL *lvl, unsigned int sx, unsigned int sy, unsigned short nval) |
Sets a FLG value for one subtile. | |
void | update_level_stats (struct LEVEL *lvl) |
Updates some statistics about the level. | |
void | update_things_stats (struct LEVEL *lvl) |
Updates statistics about the level. | |
void | update_thing_stats (struct LEVEL *lvl, const unsigned char *thing, short change) |
Updates statistics about the thing. | |
unsigned int | get_lgt_total_count (struct LEVEL *lvl) |
Returns total number of static lights on the level. | |
unsigned int | get_apt_total_count (struct LEVEL *lvl) |
Returns total number of action points on the level. | |
unsigned int | get_tng_total_count (struct LEVEL *lvl) |
Returns total number of things on the level. | |
short | get_datclm_auto_update (struct LEVEL *lvl) |
Returns state of the datclm_auto_update option for the level. | |
short | switch_datclm_auto_update (struct LEVEL *lvl) |
Switches state of the datclm_auto_update option for the level. | |
short | set_datclm_auto_update (struct LEVEL *lvl, short val) |
Sets state of the datclm_auto_update option for the level. | |
short | get_obj_auto_update (struct LEVEL *lvl) |
Returns state of the obj_auto_update option for the level. | |
short | switch_obj_auto_update (struct LEVEL *lvl) |
Switches state of the obj_auto_update option for the level. | |
short | set_obj_auto_update (struct LEVEL *lvl, short val) |
Sets state of the obj_auto_update option for the level. | |
short | set_lvl_fname (struct LEVEL *lvl, char *fname) |
Sets map file name for the level. | |
short | format_lvl_fname (struct LEVEL *lvl, char *namefmt) |
Sets map file name for the level, using given format string. | |
char * | get_lvl_fname (struct LEVEL *lvl) |
Returns map file name for the level. | |
short | set_lvl_savfname (struct LEVEL *lvl, char *fname) |
Sets map file name for saving the level. | |
short | format_lvl_savfname (struct LEVEL *lvl, char *namefmt) |
Sets map save file name for the level, using given format string. | |
char * | get_lvl_savfname (struct LEVEL *lvl) |
Returns save file name for the level. | |
char * | get_lif_name_text (struct LEVEL *lvl) |
Returns text name of the level, from LIF file. | |
short | set_lif_name_text (struct LEVEL *lvl, char *name) |
Sets text name of the level, from LIF file. | |
short | set_levels_path (struct LEVEL *lvl, char *lvpath) |
Sets path at which maps are. | |
char * | get_levels_path (struct LEVEL *lvl) |
Returns path to folder with levels. | |
short | set_data_path (struct LEVEL *lvl, char *datpath) |
Sets path at which data files are. | |
char * | get_data_path (struct LEVEL *lvl) |
Returns path to folder with data files. | |
struct DK_SCRIPT * | get_lvl_script (struct LEVEL *lvl) |
Returns pointer to the level script structure. | |
struct LEVSTATS * | get_lvl_stats (struct LEVEL *lvl) |
Returns pointer to the level statistics structure. | |
unsigned long | inc_info_usr_mdswtch_count (struct LEVEL *lvl) |
Increases mode switches counter. | |
unsigned long | inc_info_usr_slbchng_count (struct LEVEL *lvl) |
Increases SLB changes counter. | |
unsigned long | inc_info_usr_cmds_count (struct LEVEL *lvl) |
Increases total user commands counter. | |
unsigned long | inc_info_usr_creatobj_count (struct LEVEL *lvl) |
Increases user objects created counter. | |
unsigned int | inc_info_ver_major (struct LEVEL *lvl) |
Increases major version number for the level. | |
unsigned int | inc_info_ver_minor (struct LEVEL *lvl) |
Increases minor version number for the level. | |
unsigned int | inc_info_ver_rel (struct LEVEL *lvl) |
Increases version release number for the level. | |
unsigned char | get_lvl_inf (struct LEVEL *lvl) |
Returns INF entry (texture index) for the level. | |
short | get_lvl_format_version (struct LEVEL *lvl) |
Returns level format version. | |
short | set_lvl_inf (struct LEVEL *lvl, unsigned char ninf) |
Sets INF entry (texture index) for the level. | |
short | get_level_objstats_textln (struct LEVEL *lvl, char *stat_buf, const int line_num) |
Formats object statistics text line. | |
short | user_set_slab (struct LEVEL *lvl, unsigned int tx, unsigned int ty, unsigned short nslab) |
Puts a new slab on map. | |
short | user_set_tile_owner (struct LEVEL *lvl, unsigned int tx, unsigned int ty, unsigned short nown) |
Changes owner of one slab on map. | |
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. | |
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. | |
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. | |
Variables | |
const int | idir_subtl_x [] |
const int | idir_subtl_y [] |
const char | default_map_name [] = "Unnamed %Y.%m.%d map" |
int actnpt_add | ( | struct LEVEL * | lvl, | |
unsigned char * | actnpt | |||
) |
Adds a given action point to the LEVEL structure.
Updates counter variables.
lvl | Pointer to the LEVEL structure. | |
actnpt | Pointer to the action point data to add. |
Definition at line 1904 of file lev_data.c.
Referenced by load_apt().
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.
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().
Verifies action points parameters.
lvl | Pointer to the LEVEL structure. | |
err_msg | Error message output buffer. | |
errpt | Coordinates of the map tile containing the error. |
Definition at line 1349 of file lev_data.c.
Referenced by level_verify().
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.
lvl | Pointer to the LEVEL structure. | |
namefmt | The new file name, which is copied to the level. |
Definition at line 2651 of file lev_data.c.
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.
lvl | Pointer to the LEVEL structure. | |
namefmt | The save file name, which is copied to the level. |
Definition at line 2707 of file lev_data.c.
void free_map | ( | struct LEVEL * | lvl | ) |
Frees the level data stored in LEVEL structure.
Then clears LEVEL allowing to reuse it.
lvl | Pointer to the LEVEL structure. |
Definition at line 1721 of file lev_data.c.
Referenced by user_load_map().
short free_text_file | ( | char *** | lines, | |
int * | lines_count | |||
) |
Frees any text file loaded as lines.
Pointer value and lines count is cleared.
lines | Pointer to the lines array. | |
lines_count | Amount of allocated lines. |
Definition at line 1088 of file lev_data.c.
Referenced by load_lif().
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.
lvl | Pointer to the LEVEL structure. |
Definition at line 1698 of file lev_data.c.
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.
lvl | Pointer to the LEVEL structure. | |
def_slab | Default slab. |
Definition at line 1489 of file lev_data.c.
Referenced by start_new_map().
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.
lvl | Pointer to the LEVEL structure. |
Definition at line 1531 of file lev_data.c.
Referenced by generate_random_map().
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.
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 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().
unsigned int get_actnpt_subnums | ( | const struct LEVEL * | lvl, | |
unsigned int | sx, | |||
unsigned int | sy | |||
) |
Gives amount of action points existing at given subtile.
lvl | Pointer to the LEVEL structure. | |
sx,sy | Subtile at which we're counting action points. |
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().
unsigned int get_apt_total_count | ( | struct LEVEL * | lvl | ) |
Returns total number of action points on the level.
lvl | Pointer to the LEVEL structure. |
Definition at line 2532 of file lev_data.c.
Referenced by get_level_objstats_textln().
unsigned int get_dat_val | ( | const struct LEVEL * | lvl, | |
const unsigned int | sx, | |||
const unsigned int | sy | |||
) |
Returns raw DAT value for one subtile.
lvl | Pointer to the LEVEL structure. | |
sx,sy | Map subtile at which we want the DAT value. |
Definition at line 2384 of file lev_data.c.
Referenced by get_dat_subtile(), and write_dat().
char* get_data_path | ( | struct LEVEL * | lvl | ) |
Returns path to folder with data files.
lvl | Pointer to the LEVEL structure. |
Definition at line 2827 of file lev_data.c.
short get_datclm_auto_update | ( | struct LEVEL * | lvl | ) |
Returns state of the datclm_auto_update option for the level.
lvl | Pointer to the LEVEL structure. |
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().
short get_level_objstats_textln | ( | struct LEVEL * | lvl, | |
char * | stat_buf, | |||
const int | line_num | |||
) |
Formats object statistics text line.
lvl | Pointer to the LEVEL structure. | |
stat_buf | Destination text buffer. | |
line_num | Line number to retrieve. |
Definition at line 2989 of file lev_data.c.
char* get_levels_path | ( | struct LEVEL * | lvl | ) |
Returns path to folder with levels.
lvl | Pointer to the LEVEL structure. |
Definition at line 2791 of file lev_data.c.
unsigned int get_lgt_total_count | ( | struct LEVEL * | lvl | ) |
Returns total number of static lights on the level.
lvl | Pointer to the LEVEL structure. |
Definition at line 2521 of file lev_data.c.
Referenced by get_level_objstats_textln().
char* get_lif_name_text | ( | struct LEVEL * | lvl | ) |
Returns text name of the level, from LIF file.
lvl | Pointer to the LEVEL structure. |
Definition at line 2740 of file lev_data.c.
Referenced by write_lif(), and write_nfo().
char* get_lvl_fname | ( | struct LEVEL * | lvl | ) |
Returns map file name for the level.
lvl | Pointer to the LEVEL structure. |
Definition at line 2671 of file lev_data.c.
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().
lvl | Pointer to the LEVEL structure. |
Definition at line 2963 of file lev_data.c.
unsigned char get_lvl_inf | ( | struct LEVEL * | lvl | ) |
Returns INF entry (texture index) for the level.
lvl | Pointer to the LEVEL structure. |
Definition at line 2951 of file lev_data.c.
char* get_lvl_savfname | ( | struct LEVEL * | lvl | ) |
Returns save file name for the level.
lvl | Pointer to the LEVEL structure. |
Definition at line 2727 of file lev_data.c.
Returns pointer to the level script structure.
lvl | Pointer to the LEVEL structure. |
Definition at line 2838 of file lev_data.c.
Returns pointer to the level statistics structure.
lvl | Pointer to the LEVEL structure. |
Definition at line 2849 of file lev_data.c.
Referenced by get_level_objstats_textln(), and user_save_map().
short get_obj_auto_update | ( | struct LEVEL * | lvl | ) |
Returns state of the obj_auto_update option for the level.
lvl | Pointer to the LEVEL structure. |
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().
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'.
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 2122 of file lev_data.c.
Referenced by get_nearest_object_idx().
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'.
lvl | Pointer to the LEVEL structure. | |
sx,sy | Subtile at which we're counting objects. |
Definition at line 2187 of file lev_data.c.
Referenced by get_nearest_object_idx(), and get_object_subtl_last().
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.
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. |
Definition at line 2220 of file lev_data.c.
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'.
lvl | Pointer to the LEVEL structure. | |
tx,ty | Tile at which we're counting objects. |
Definition at line 2206 of file lev_data.c.
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'.
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 2095 of file lev_data.c.
Referenced by get_nearest_object_idx().
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.
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 1988 of file lev_data.c.
Referenced by draw_things_on_buffer(), find_next_stlight_on_map(), get_object(), and write_lgt().
unsigned int get_stlight_subnums | ( | const struct LEVEL * | lvl, | |
unsigned int | sx, | |||
unsigned int | sy | |||
) |
Gives amount of static lights existing at given subtile.
lvl | Pointer to the LEVEL structure. | |
sx,sy | Subtile at which we're counting static lights. |
Definition at line 2074 of file lev_data.c.
Referenced by draw_things_on_buffer(), remove_automade_obj_for_slab(), and write_lgt().
unsigned short get_subtl_flg | ( | struct LEVEL * | lvl, | |
unsigned int | sx, | |||
unsigned int | sy | |||
) |
Returns FLG value for one subtile.
lvl | Pointer to the LEVEL structure. | |
sx,sy | Map subtile at which we want the FLG value. |
Definition at line 2411 of file lev_data.c.
Referenced by write_flg().
unsigned char get_subtl_owner | ( | const struct LEVEL * | lvl, | |
unsigned int | sx, | |||
unsigned int | sy | |||
) |
Gives owner (OWN value) for a subtile.
lvl | Pointer to the LEVEL structure. | |
sx,sy | Map subtile at which we want the owner value. |
Definition at line 2302 of file lev_data.c.
Referenced by draw_map_on_buffer(), get_tile_owner(), and write_own().
short get_subtl_wib | ( | struct LEVEL * | lvl, | |
unsigned int | sx, | |||
unsigned int | sy | |||
) |
Gives WIBble value for a subtile.
lvl | Pointer to the LEVEL structure. | |
sx,sy | Map subtile at which we want the WIB value. |
Definition at line 2247 of file lev_data.c.
Referenced by write_wib().
char* get_thing | ( | const struct LEVEL * | lvl, | |
unsigned int | sx, | |||
unsigned int | sy, | |||
unsigned int | num | |||
) |
Returns thing data for thing at given position.
lvl | Pointer to the LEVEL structure. | |
sx,sy | Subtile at which the thing is. | |
num | Index of thing on the subtile. |
Definition at line 1761 of file lev_data.c.
Referenced by create_herogate_number_used_arr(), delete_room_things_subtl(), draw_things_on_buffer(), find_thing_on_tile(), get_free_indexedthing_number(), get_nearest_thing_idx(), get_object(), get_slab_surround(), level_verify_logic(), level_verify_struct(), owned_things_count(), remove_automade_obj_for_slab(), remove_misplaced_objs_on_slab(), remove_noncrucial_room_things(), set_door_lock(), subtl_in_effectgen_range(), things_verify(), 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(), update_things_slb_portal_inside(), update_things_stats(), update_things_subpos_and_height_for_slab(), write_def_tng_source(), and write_tng().
unsigned int get_thing_subnums | ( | const struct LEVEL * | lvl, | |
unsigned int | sx, | |||
unsigned int | sy | |||
) |
Gives amount of things existing at given subtile.
lvl | Pointer to the LEVEL structure. | |
sx,sy | Subtile at which we're counting thing. |
Definition at line 1866 of file lev_data.c.
Referenced by delete_room_things_subtl(), draw_things_on_buffer(), find_thing_on_tile(), get_nearest_thing_idx(), get_slab_surround(), level_verify_logic(), level_verify_struct(), owned_things_count(), remove_automade_obj_for_slab(), remove_misplaced_objs_on_slab(), remove_noncrucial_room_things(), set_door_lock(), subtl_in_effectgen_range(), things_verify(), 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(), update_things_slb_portal_inside(), update_things_stats(), update_things_subpos_and_height_for_slab(), write_def_tng_source(), and write_tng().
unsigned char get_tile_owner | ( | const struct LEVEL * | lvl, | |
unsigned int | tx, | |||
unsigned int | ty | |||
) |
Gives owner (OWN value) for a tile.
lvl | Pointer to the LEVEL structure. | |
tx,ty | Map tile at which we want the owner value. |
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().
unsigned short get_tile_slab | ( | const struct LEVEL * | lvl, | |
unsigned int | tx, | |||
unsigned int | ty | |||
) |
Gives slab (SLB value) for a tile.
lvl | Pointer to the LEVEL structure. | |
tx,ty | Map tile at which we want the slab value. |
Definition at line 2355 of file lev_data.c.
Referenced by actnpts_verify(), compute_door_orientation(), compute_item_sensitile(), compute_torch_sensitile(), draw_map_on_buffer(), get_slab_surround(), level_verify_logic(), remove_automade_obj_for_slab(), remove_misplaced_objs_on_slab(), set_graffiti_orientation(), slab_is_central(), slab_siblings_oftype(), slabs_verify(), subtl_is_near_tall_slab(), things_verify(), update_clmaffective_obj_for_slab(), update_door_things_on_slab(), update_room_things_on_slab(), update_slab_owners(), update_tile_flg_entries(), update_tile_wlb_entry(), update_torch_things_near_slab(), and write_slb().
short get_tile_wlb | ( | struct LEVEL * | lvl, | |
unsigned int | tx, | |||
unsigned int | ty | |||
) |
Gives WLB (Water-Lava Block) value for a tile.
lvl | Pointer to the LEVEL structure. | |
tx,ty | Map tile at which we want the WLB value. |
Definition at line 2275 of file lev_data.c.
Referenced by update_tile_wlb_entry().
unsigned int get_tng_total_count | ( | struct LEVEL * | lvl | ) |
Returns total number of things on the level.
lvl | Pointer to the LEVEL structure. |
Definition at line 2543 of file lev_data.c.
Referenced by get_level_objstats_textln().
unsigned long inc_info_usr_cmds_count | ( | struct LEVEL * | lvl | ) |
Increases total user commands counter.
Used for user commands statistics for the level.
lvl | Pointer to the LEVEL structure. |
Definition at line 2887 of file lev_data.c.
unsigned long inc_info_usr_creatobj_count | ( | struct LEVEL * | lvl | ) |
Increases user objects created counter.
Used for user commands statistics for the level.
lvl | Pointer to the LEVEL structure. |
Definition at line 2900 of file lev_data.c.
unsigned long inc_info_usr_mdswtch_count | ( | struct LEVEL * | lvl | ) |
Increases mode switches counter.
Used for user commands statistics for the level.
lvl | Pointer to the LEVEL structure. |
Definition at line 2861 of file lev_data.c.
unsigned long inc_info_usr_slbchng_count | ( | struct LEVEL * | lvl | ) |
Increases SLB changes counter.
Used for user commands statistics for the level.
lvl | Pointer to the LEVEL structure. |
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().
unsigned int inc_info_ver_major | ( | struct LEVEL * | lvl | ) |
Increases major version number for the level.
lvl | Pointer to the LEVEL structure. |
Definition at line 2912 of file lev_data.c.
Referenced by user_save_map().
unsigned int inc_info_ver_minor | ( | struct LEVEL * | lvl | ) |
Increases minor version number for the level.
lvl | Pointer to the LEVEL structure. |
Definition at line 2926 of file lev_data.c.
Referenced by user_save_map().
unsigned int inc_info_ver_rel | ( | struct LEVEL * | lvl | ) |
Increases version release number for the level.
lvl | Pointer to the LEVEL structure. |
Definition at line 2939 of file lev_data.c.
Referenced by user_save_map().
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.
lvl | Pointer to the LEVEL structure. |
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.
lvl | Pointer to the LEVEL structure. |
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.
lvl | Pointer to the LEVEL structure. |
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.
lvl | Pointer to the LEVEL structure. |
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.
lvl | Pointer to the LEVEL structure. |
Definition at line 511 of file lev_data.c.
Referenced by level_clear().
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.
optns | The LEVOPTIONS structure to clear. |
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.
lvl | Pointer to the LEVEL structure. |
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.
lvl | Pointer to the LEVEL structure. |
Definition at line 647 of file lev_data.c.
Referenced by level_clear().
short level_clear_script_param | ( | struct DK_SCRIPT_PARAMETERS * | par | ) |
Clears (via zeroing) given script parameters struct.
par | Pointer to the DK_SCRIPT_PARAMETERS structure. |
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.
lvl | Pointer to the LEVEL structure. |
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.
lvl | Pointer to the LEVEL structure. |
Definition at line 457 of file lev_data.c.
Referenced by level_clear().
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.
lvl_ptr | Double pointer to the LEVEL structure. |
Definition at line 842 of file lev_data.c.
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).
lvl | Pointer to the LEVEL structure. |
Definition at line 1139 of file lev_data.c.
Referenced by free_map(), load_dk1_map(), load_dke_map(), and load_map_preview().
short level_free_apt | ( | struct LEVEL * | lvl | ) |
Frees "action points" structure for storing level.
Disposes only data pointers, the array structure remains intact (as after level_init(), but values are not cleared).
lvl | Pointer to the LEVEL structure. |
Definition at line 1037 of file lev_data.c.
Referenced by level_free().
short level_free_lgt | ( | struct LEVEL * | lvl | ) |
Frees LGT structure for storing level lights.
Disposes only data pointers, the array structure remains intact (as after level_init(), but values are not cleared).
lvl | Pointer to the LEVEL structure. |
Definition at line 1109 of file lev_data.c.
Referenced by level_free().
short level_free_script_param | ( | struct DK_SCRIPT_PARAMETERS * | par | ) |
Frees all sub-structures of given DK_SCRIPT_PARAMETERS.
par | Pointer to the DK_SCRIPT_PARAMETERS structure. |
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).
lvl | Pointer to the LEVEL structure. |
Definition at line 1008 of file lev_data.c.
Referenced by level_free().
short level_free_txt | ( | struct LEVEL * | lvl | ) |
Frees TXT structure for storing level script.
Disposes only data pointers, the array structure remains intact (as after level_init(), but values are not cleared).
lvl | Pointer to the LEVEL structure. |
Definition at line 1066 of file lev_data.c.
Referenced by level_free().
short level_generate_random_extension | ( | struct LEVEL * | lvl, | |
char * | ret_msg | |||
) |
Adds random extension to the level.
lvl | Pointer to the LEVEL structure. | |
ret_msg | Text message returned by function. |
Definition at line 1733 of file lev_data.c.
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.
lvl | Pointer to the LEVEL structure. |
Definition at line 446 of file lev_data.c.
struct LEVOPTIONS* level_get_options | ( | struct LEVEL * | lvl | ) | [read] |
Gets all options for the LEVEL structure.
Returns direct pointer to the structure.
lvl | Pointer to the LEVEL structure. |
Definition at line 420 of file lev_data.c.
struct DK_SCRIPT_PARAMETERS* level_get_script_param | ( | struct LEVEL * | lvl | ) | [read] |
Returns DK_SCRIPT_PARAMETERS struct for given level.
lvl | Pointer to the LEVEL structure. |
Definition at line 1157 of file lev_data.c.
Creates object for storing one level.
Allocates memory and inits the values to zero; drops any previous pointers without deallocating.
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. |
Definition at line 53 of file lev_data.c.
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.
lvl | Pointer to the LEVEL structure. | |
mdrwopts | The MAPDRAW_OPTIONS structure to copy from. |
Definition at line 433 of file lev_data.c.
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.
lvl | Pointer to the LEVEL structure. | |
optns | The LEVOPTIONS structure to copy from. |
Definition at line 407 of file lev_data.c.
Resizes arrays in object for storing level.
Allocates memory and inits the values to zero; deallocates previous pointers.
lvl | Pointer to the level structure. | |
lvl_size | Level size struct. |
Definition at line 357 of file lev_data.c.
Verifies the whole level.
On error adds description message to the error messages log.
lvl | Pointer to the LEVEL structure. | |
actn_name | Name of the action which invoked verification. | |
errpt | Coordinates of the map tile containing the error. |
Definition at line 1173 of file lev_data.c.
Referenced by user_save_map().
Verifies various logic aspects of a map.
lvl | Pointer to the LEVEL structure. | |
err_msg | Error message output buffer. | |
errpt | Coordinates of the map tile containing the error. |
Definition at line 1402 of file lev_data.c.
Referenced by level_verify().
Verifies internal LEVEL structure integrity.
lvl | Pointer to the LEVEL structure. | |
err_msg | Error message output buffer. | |
errpt | Coordinates of the map tile containing the error. |
Definition at line 1247 of file lev_data.c.
Referenced by level_verify().
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'.
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.
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.
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().
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.
lvl | Pointer to the LEVEL structure. | |
datpath | The new path for data files folder. |
Definition at line 2804 of file lev_data.c.
short set_datclm_auto_update | ( | struct LEVEL * | lvl, | |
short | val | |||
) |
Sets state of the datclm_auto_update option for the level.
lvl | Pointer to the LEVEL structure. | |
val | New state of the option. |
Definition at line 2579 of file lev_data.c.
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.
lvl | Pointer to the LEVEL structure. | |
lvpath | The new path for levels folder. |
Definition at line 2770 of file lev_data.c.
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.
lvl | Pointer to the LEVEL structure. | |
name | New text name of the level. |
Definition at line 2755 of file lev_data.c.
Referenced by execute_adikted_command(), load_lif(), and load_slb().
short set_lvl_fname | ( | struct LEVEL * | lvl, | |
char * | fname | |||
) |
Sets map file name for the level.
lvl | Pointer to the LEVEL structure. | |
fname | The new file name, which is copied to the level. |
Definition at line 2629 of file lev_data.c.
short set_lvl_inf | ( | struct LEVEL * | lvl, | |
unsigned char | ninf | |||
) |
Sets INF entry (texture index) for the level.
lvl | Pointer to the LEVEL structure. | |
ninf | New INF entry for the level. |
Definition at line 2975 of file lev_data.c.
short set_lvl_savfname | ( | struct LEVEL * | lvl, | |
char * | fname | |||
) |
Sets map file name for saving the level.
lvl | Pointer to the LEVEL structure. | |
fname | The new file name to save on. |
Definition at line 2685 of file lev_data.c.
short set_obj_auto_update | ( | struct LEVEL * | lvl, | |
short | val | |||
) |
Sets state of the obj_auto_update option for the level.
lvl | Pointer to the LEVEL structure. | |
val | New state of the option. |
Definition at line 2616 of file lev_data.c.
void set_subtl_flg | ( | struct LEVEL * | lvl, | |
unsigned int | sx, | |||
unsigned int | sy, | |||
unsigned short | nval | |||
) |
Sets a FLG value for one subtile.
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().
void set_subtl_owner | ( | struct LEVEL * | lvl, | |
unsigned int | sx, | |||
unsigned int | sy, | |||
unsigned char | nval | |||
) |
Sets owner (OWN value) for a subtile.
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().
void set_subtl_wib | ( | struct LEVEL * | lvl, | |
unsigned int | sx, | |||
unsigned int | sy, | |||
short | nval | |||
) |
Sets WIBble value for a subtile.
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().
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.
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().
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.
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().
void set_tile_wlb | ( | struct LEVEL * | lvl, | |
unsigned int | tx, | |||
unsigned int | ty, | |||
short | nval | |||
) |
Sets WLB (Water-Lava Block) value for a tile.
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().
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.
lvl | Pointer to the LEVEL structure. |
Definition at line 1668 of file lev_data.c.
Referenced by user_load_map().
int stlight_add | ( | struct LEVEL * | lvl, | |
unsigned char * | stlight | |||
) |
Adds a given static light to the LEVEL structure.
Updates counter variables.
lvl | Pointer to the LEVEL structure. | |
stlight | Pointer to the static light data to add. |
Definition at line 2008 of file lev_data.c.
Referenced by load_lgt().
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.
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().
short switch_datclm_auto_update | ( | struct LEVEL * | lvl | ) |
Switches state of the datclm_auto_update option for the level.
lvl | Pointer to the LEVEL structure. |
Definition at line 2565 of file lev_data.c.
short switch_obj_auto_update | ( | struct LEVEL * | lvl | ) |
Switches state of the obj_auto_update option for the level.
lvl | Pointer to the LEVEL structure. |
Definition at line 2602 of file lev_data.c.
int thing_add | ( | struct LEVEL * | lvl, | |
unsigned char * | thing | |||
) |
Adds a thing to the structure and returns its index.
Also updates statistics.
lvl | Pointer to the LEVEL structure. | |
thing | Pointer to the thing data to add. |
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().
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.
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().
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.
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().
void update_level_stats | ( | struct LEVEL * | lvl | ) |
Updates some statistics about the level.
The update includes "utilize" values of columns.
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().
void update_thing_stats | ( | struct LEVEL * | lvl, | |
const unsigned char * | thing, | |||
short | change | |||
) |
Updates statistics about the thing.
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().
void update_things_stats | ( | struct LEVEL * | lvl | ) |
Updates statistics about the level.
Does not updates "utilize" values of columns.
lvl | Pointer to the LEVEL structure. |
Definition at line 2447 of file lev_data.c.
Referenced by update_level_stats().
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.
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. |
Definition at line 3197 of file lev_data.c.
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.
lvl | Pointer to the LEVEL structure. | |
tx,ty | Map coordinates of the slab to change. | |
nslab | New value for the tile slab. |
Definition at line 3113 of file lev_data.c.
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.
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. |
Definition at line 3161 of file lev_data.c.
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.
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. |
Definition at line 3232 of file lev_data.c.
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.
lvl | Pointer to the LEVEL structure. | |
tx,ty | Map coordinates of the owner to change. | |
nown | New value for the tile owner. |
Definition at line 3137 of file lev_data.c.
const char default_map_name[] = "Unnamed %Y.%m.%d map" |
const int idir_subtl_x[] |
Initial value:
{ 0, 1, 2, 0, 1, 2, 0, 1, 2,}
Definition at line 32 of file lev_data.c.
Referenced by set_new_datclm_values(), update_things_slb_prison(), update_things_subpos_and_height_for_slab(), and update_torch_things_near_slab().
const int idir_subtl_y[] |
Initial value:
{ 0, 0, 0, 1, 1, 1, 2, 2, 2,}
Definition at line 37 of file lev_data.c.
Referenced by set_new_datclm_values(), update_things_slb_prison(), update_things_subpos_and_height_for_slab(), and update_torch_things_near_slab().