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++) {
139 if (layout[i][j] ==
'C' || layout[i][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++) {
225 object *the_chest = NULL;
246 if (the_chest == NULL) {
270 the_chest->
stats.
hp = n_treasures;
293 if (new_trap->
level == 0) {
306 if ((treasureoptions&
KEYREQUIRED) && n_treasures > 1) {
344 if (lx >= 0 && ly >= 0 && lx < RP->Xsize && ly < RP->Ysize)
388 object *the_keymaster;
391 const char *keys[] = {
"key2",
"blue_key",
"brown_key",
"darkgray_key",
"darkgreen_key",
"gray_key",
"green_key",
"magenta_key",
"red_key",
"white_key" };
403 the_keymaster = NULL;
404 while (tries < 15 && the_keymaster == NULL) {
411 if (the_keymaster == NULL) {
415 for (tries = 0; tries < 15 && freeindex == -1; tries++) {
420 if (freeindex != -1) {
434 if (the_keymaster == NULL)
445 while (distance < 5) {
467 if (the_keymaster == NULL) {
496 if (!(x >= 0 && y >= 0 && x < RP->Xsize && y < RP->Ysize)) {
501 if (layout[x][y] != 0) {
511 return HEAD(the_monster);
517 for (i =
RANDOM()%8, j = 0; j < 8; i++, j++) {
521 if (the_monster != NULL) {
546 object *theMonsterToFind;
548 layout2 = (
char **)calloc(
sizeof(
char *), RP->
Xsize);
550 for (i = 0; i < RP->
Xsize; i++) {
551 layout2[i] = (
char *)calloc(
sizeof(
char), RP->
Ysize);
552 for (j = 0; j < RP->
Ysize; j++) {
561 for (i = 0; i < RP->
Xsize; i++) {
566 return theMonsterToFind;
595 if (!(x >= 0 && y >= 0 && x < RP->Xsize && y < RP->Ysize)) {
600 if (layout[x][y] != 0) {
611 for (i =
RANDOM()%8, j = 0; j < 8; i++, j++) {
644 layout2 = (
char **)calloc(
sizeof(
char *), RP->
Xsize);
646 for (i = 0; i < RP->
Xsize; i++) {
647 layout2[i] = (
char *)calloc(
sizeof(
char), RP->
Ysize);
648 for (j = 0; j < RP->
Ysize; j++) {
665 for (i = 0; i < RP->
Xsize; i++) {
704 if (sindex == 7 || sindex == 11 || sindex == 13 || sindex == 14) {
720 if (sindex == 3 || sindex == 5 || sindex == 9 || sindex == 6 || sindex == 10 || sindex == 12) {
800 const char *doors[2];
803 doorlist = (
object **)calloc(9,
sizeof(
object *));
807 doors[0] =
"locked_door2";
808 doors[1] =
"locked_door1";
815 for (i = 1; i < 9; i++) {
819 || layout[x1][y1] ==
'>') {
820 object *new_door =
create_archetype((freearr_x[i] == 0) ? doors[1] : doors[0]);
827 doorlist[ndoors_made] = new_door;
875 if (!(x >= 0 && y >= 0 && x < RP->Xsize && y < RP->Ysize)) {
880 if (layout[x][y] == 1) {
885 if (layout[x][y] ==
'#') {
889 doorlist[*ndoors] = door;
891 LOG(
llevError,
"find_doors_in_room_recursive:Too many doors for memory allocated!\n");
899 for (i =
RANDOM()%8, j = 0; j < 8; i++, j++) {
926 doorlist = (
object **)calloc(
sizeof(*doorlist), 256);
929 layout2 = (
char **)calloc(
sizeof(
char *), RP->
Xsize);
931 for (i = 0; i < RP->
Xsize; i++) {
932 layout2[i] = (
char *)calloc(
sizeof(
char), RP->
Ysize);
933 for (j = 0; j < RP->
Ysize; j++) {
944 for (i = 0; i < RP->
Xsize; i++) {
967 for (i = 1; i <= 8; i++) {
978 if (tmp->type ==
DOOR) {
1011 for (i = 0, door = doorlist[0]; doorlist[i] != NULL; i++) {
1019 doorlist[i] = new_door;
1027 for (i = 0; doorlist[i] != NULL; i++) {
1034 for (i = 0, door = doorlist[0]; doorlist[i] != NULL; i++) {
1039 if (wallface != NULL) {
static void find_spot_in_room_recursive(char **layout, int x, int y, RMParms *RP, free_spots_struct *spots)
archetype * find_archetype(const char *name)
object ** find_doors_in_room(mapstruct *map, int x, int y, RMParms *RP)
void find_enclosed_spot(mapstruct *map, int *cx, int *cy, RMParms *RP)
void find_doors_in_room_recursive(char **layout, mapstruct *map, int x, int y, object **doorlist, int *ndoors, RMParms *RP)
void remove_monsters(int x, int y, mapstruct *map)
void lock_and_hide_doors(object **doorlist, mapstruct *map, int opts, RMParms *RP)
void object_copy_with_inv(const object *src_ob, object *dest_ob)
void place_treasure(mapstruct *map, char **layout, char *treasure_style, int treasureoptions, RMParms *RP)
treasurelist * find_treasurelist(const char *name)
int number_of_free_spots_in_room
void free_string(sstring str)
struct free_spots_struct free_spots_struct
int keyplace(mapstruct *map, int x, int y, char *keycode, int door_flag, int n_keys, RMParms *RP)
struct treasureliststruct * randomitems
short freearr_x[SIZEOFFREE]
int find_spot_in_room(mapstruct *map, int x, int y, int *kx, int *ky, RMParms *RP)
#define OUT_OF_REAL_MAP(M, X, Y)
object * pick_random_object(mapstruct *style)
short freearr_y[SIZEOFFREE]
void object_free_drop_inventory(object *ob)
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
object * object_new(void)
object * create_archetype(const char *name)
object * object_insert_in_ob(object *op, object *where)
long unsigned int total_map_hp
int surround_flag3(mapstruct *map, int i, int j, RMParms *RP)
object * find_closest_monster(mapstruct *map, int x, int y, RMParms *RP)
char dungeon_name[RM_SIZE]
object * retrofit_joined_wall(mapstruct *the_map, int i, int j, int insert_flag, RMParms *RP)
static object ** surround_by_doors(mapstruct *map, char **layout, int x, int y, int opts)
object * find_monster_in_room(mapstruct *map, int x, int y, RMParms *RP)
#define GET_MAP_MOVE_BLOCK(M, X, Y)
#define SQUARE_SPIRAL_LAYOUT
#define QUERY_FLAG(xyz, p)
static void remove_adjacent_doors(object *door)
static object * door_in_square(mapstruct *map, int x, int y)
int wall_blocked(mapstruct *m, int x, int y)
#define MOVE_BLOCK_DEFAULT
int object_find_first_free_spot(const object *ob, mapstruct *m, int x, int y)
static const flag_definition flags[]
#define GET_MAP_FLAGS(M, X, Y)
sstring add_string(const char *str)
#define GET_MAP_OB(M, X, Y)
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
void LOG(LogLevel logLevel, const char *format,...)
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
mapstruct * find_style(const char *dirname, const char *stylename, int difficulty)
object * place_chest(int treasureoptions, int x, int y, mapstruct *map, int n_treasures, RMParms *RP)
void object_remove(object *op)
object * find_monster_in_room_recursive(char **layout, mapstruct *map, int x, int y, RMParms *RP)