Go to the documentation of this file.
35 #define CONCENTRATED 1
43 #define LAST_OPTION 64
46 #define NO_PASS_DOORS 0
98 if (!strcmp(treasure_style,
"none")) {
101 if (treasureoptions <= 0) {
106 if ((treasureoptions&
RICH) && (treasureoptions&
SPARSE)) {
108 treasureoptions -= 1;
110 treasureoptions -= 2;
115 if (treasureoptions&
SPARSE) {
117 }
else if (treasureoptions&
RICH) {
123 if (num_treasures <= 0) {
137 for (i = 0; i < RP->
Xsize; i++) {
138 for (j = 0; j < RP->
Ysize; j++) {
148 chest =
place_chest(treasureoptions, i, j,
map, num_treasures/tdiv, RP);
169 while (i == -1 && tries < 100) {
178 chest =
place_chest(treasureoptions, i, j,
map, num_treasures, RP);
194 for (ti = 0; ti < num_treasures; ti++) {
222 object *the_chest = NULL;
229 if ((uint32_t)(
RANDOM() % 1000000) < (uint32_t)(
map->difficulty*
map->difficulty*
map->difficulty))
247 if (the_chest == NULL) {
271 the_chest->
stats.
hp = n_treasures;
294 if (new_trap->
level == 0) {
307 if ((treasureoptions&
KEYREQUIRED) && n_treasures > 1) {
310 snprintf(keybuf,
sizeof(keybuf),
"%d", (
int)
RANDOM());
345 if (lx >= 0 && ly >= 0 && lx < RP->Xsize && ly < RP->Ysize)
389 object *the_keymaster;
392 const char *
keys[] = {
"key2",
"blue_key",
"brown_key",
"darkgray_key",
"darkgreen_key",
"gray_key",
"green_key",
"magenta_key",
"red_key",
"white_key" };
404 the_keymaster = NULL;
405 while (tries < 15 && the_keymaster == NULL) {
412 if (the_keymaster == NULL) {
416 for (tries = 0; tries < 15 && freeindex == -1; tries++) {
421 if (freeindex != -1) {
435 if (the_keymaster == NULL)
446 while (distance < 5) {
468 if (the_keymaster == NULL) {
497 if (!(
x >= 0 &&
y >= 0 && x < RP->Xsize && y < RP->Ysize)) {
512 return HEAD(the_monster);
518 for (i =
RANDOM()%8, j = 0; j < 8; i++, j++) {
522 if (the_monster != NULL) {
547 object *theMonsterToFind;
549 layout2 = (
char **)calloc(
sizeof(
char *), RP->
Xsize);
551 for (i = 0; i < RP->
Xsize; i++) {
552 layout2[i] = (
char *)calloc(
sizeof(
char), RP->
Ysize);
553 for (j = 0; j < RP->
Ysize; j++) {
562 for (i = 0; i < RP->
Xsize; i++) {
567 return theMonsterToFind;
596 if (!(
x >= 0 &&
y >= 0 && x < RP->Xsize && y < RP->Ysize)) {
612 for (i =
RANDOM()%8, j = 0; j < 8; i++, j++) {
645 layout2 = (
char **)calloc(
sizeof(
char *), RP->
Xsize);
647 for (i = 0; i < RP->
Xsize; i++) {
648 layout2[i] = (
char *)calloc(
sizeof(
char), RP->
Ysize);
649 for (j = 0; j < RP->
Ysize; j++) {
666 for (i = 0; i < RP->
Xsize; i++) {
705 if (sindex == 7 || sindex == 11 || sindex == 13 || sindex == 14) {
721 if (sindex == 3 || sindex == 5 || sindex == 9 || sindex == 6 || sindex == 10 || sindex == 12) {
801 const char *doors[2];
804 doorlist = (
object **)calloc(9,
sizeof(
object *));
808 doors[0] =
"locked_door2";
809 doors[1] =
"locked_door1";
816 for (i = 1; i < 9; i++) {
828 doorlist[ndoors_made] = new_door;
876 if (!(
x >= 0 &&
y >= 0 && x < RP->Xsize && y < RP->Ysize)) {
890 doorlist[*ndoors] = door;
892 LOG(
llevError,
"find_doors_in_room_recursive:Too many doors for memory allocated!\n");
900 for (i =
RANDOM()%8, j = 0; j < 8; i++, j++) {
927 doorlist = (
object **)calloc(
sizeof(*doorlist), 256);
930 layout2 = (
char **)calloc(
sizeof(
char *), RP->
Xsize);
932 for (i = 0; i < RP->
Xsize; i++) {
933 layout2[i] = (
char *)calloc(
sizeof(
char), RP->
Ysize);
934 for (j = 0; j < RP->
Ysize; j++) {
945 for (i = 0; i < RP->
Xsize; i++) {
968 for (i = 1; i <= 8; i++) {
1012 for (i = 0, door = doorlist[0]; doorlist[i] != NULL; i++) {
1020 doorlist[i] = new_door;
1023 snprintf(keybuf, 256,
"%d", (
int)
RANDOM());
1028 for (i = 0; doorlist[i] != NULL; i++) {
1035 for (i = 0, door = doorlist[0]; doorlist[i] != NULL; i++) {
1040 if (wallface != NULL) {
#define GET_MAP_OB(M, X, Y)
int object_find_first_free_spot(const object *ob, mapstruct *m, int x, int y)
object ** find_doors_in_room(mapstruct *map, int x, int y, RMParms *RP)
sstring add_string(const char *str)
void object_remove(object *op)
#define MOVE_BLOCK_DEFAULT
static void find_spot_in_room_recursive(char **layout, int x, int y, RMParms *RP, free_spots_struct *spots)
object * retrofit_joined_wall(mapstruct *the_map, int i, int j, int insert_flag, RMParms *RP)
#define QUERY_FLAG(xyz, p)
arch
DIALOGCHECK MINARGS 1 MAXARGS 1
object * find_closest_monster(mapstruct *map, int x, int y, RMParms *RP)
object * find_monster_in_room(mapstruct *map, int x, int y, RMParms *RP)
object * object_new(void)
int keyplace(mapstruct *map, int x, int y, char *keycode, int door_flag, int n_keys, RMParms *RP)
treasurelist * find_treasurelist(const char *name)
mapstruct * find_style(const char *dirname, const char *stylename, int difficulty)
static const flag_definition flags[]
void lock_and_hide_doors(object **doorlist, mapstruct *map, int opts, RMParms *RP)
struct treasureliststruct * randomitems
short freearr_x[SIZEOFFREE]
short freearr_y[SIZEOFFREE]
void free_string(sstring str)
static event_registration m
void object_copy_with_inv(const object *src_ob, object *dest_ob)
int number_of_free_spots_in_room
#define SQUARE_SPIRAL_LAYOUT
void find_enclosed_spot(mapstruct *map, int *cx, int *cy, RMParms *RP)
void remove_monsters(int x, int y, mapstruct *map)
void place_treasure(mapstruct *map, char **layout, char *treasure_style, int treasureoptions, RMParms *RP)
static void remove_adjacent_doors(object *door)
static object ** surround_by_doors(mapstruct *map, char **layout, int x, int y, int opts)
#define GET_MAP_MOVE_BLOCK(M, X, Y)
object * create_archetype(const char *name)
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
object * find_monster_in_room_recursive(char **layout, mapstruct *map, int x, int y, RMParms *RP)
#define OUT_OF_REAL_MAP(M, X, Y)
void find_doors_in_room_recursive(char **layout, mapstruct *map, int x, int y, object **doorlist, int *ndoors, RMParms *RP)
void LOG(LogLevel logLevel, const char *format,...)
long unsigned int total_map_hp
object * place_chest(int treasureoptions, int x, int y, mapstruct *map, int n_treasures, RMParms *RP)
int wall_blocked(mapstruct *m, int x, int y)
archetype * find_archetype(const char *name)
object * pick_random_object(mapstruct *style)
object * object_insert_in_ob(object *op, object *where)
char dungeon_name[RM_SIZE]
struct free_spots_struct free_spots_struct
static object * door_in_square(mapstruct *map, int x, int y)
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
void object_free_drop_inventory(object *ob)
#define GET_MAP_FLAGS(M, X, Y)
int surround_flag3(mapstruct *map, int i, int j, RMParms *RP)
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
int find_spot_in_room(mapstruct *map, int x, int y, int *kx, int *ky, RMParms *RP)