… | |
… | |
59 | maptile::generate_random_map (random_map_params *RP) |
59 | maptile::generate_random_map (random_map_params *RP) |
60 | { |
60 | { |
61 | char **layout, buf[16384]; |
61 | char **layout, buf[16384]; |
62 | int i; |
62 | int i; |
63 | |
63 | |
|
|
64 | RP->Xsize = RP->xsize; |
|
|
65 | RP->Ysize = RP->ysize; |
|
|
66 | |
64 | /* pick a random seed, or use the one from the input file */ |
67 | /* pick a random seed, or use the one from the input file */ |
65 | RP->random_seed = RP->random_seed |
68 | RP->random_seed = RP->random_seed |
66 | ? RP->random_seed + RP->dungeon_level |
69 | ? RP->random_seed + RP->dungeon_level |
67 | : time (0); |
70 | : time (0); |
68 | CEDE; |
71 | CEDE; |
… | |
… | |
93 | else |
96 | else |
94 | RP->symmetry_used = RP->symmetry; |
97 | RP->symmetry_used = RP->symmetry; |
95 | |
98 | |
96 | if (RP->symmetry_used == SYMMETRY_Y || RP->symmetry_used == SYMMETRY_XY) |
99 | if (RP->symmetry_used == SYMMETRY_Y || RP->symmetry_used == SYMMETRY_XY) |
97 | RP->Ysize = RP->Ysize / 2 + 1; |
100 | RP->Ysize = RP->Ysize / 2 + 1; |
|
|
101 | |
98 | if (RP->symmetry_used == SYMMETRY_X || RP->symmetry_used == SYMMETRY_XY) |
102 | if (RP->symmetry_used == SYMMETRY_X || RP->symmetry_used == SYMMETRY_XY) |
99 | RP->Xsize = RP->Xsize / 2 + 1; |
103 | RP->Xsize = RP->Xsize / 2 + 1; |
100 | |
104 | |
101 | if (RP->expand2x > 0) |
105 | if (RP->expand2x > 0) |
102 | { |
106 | { |
… | |
… | |
152 | |
156 | |
153 | /* allocate the map and set the floor */ |
157 | /* allocate the map and set the floor */ |
154 | make_map_floor (layout, RP->floorstyle, RP); |
158 | make_map_floor (layout, RP->floorstyle, RP); |
155 | |
159 | |
156 | /* set region */ |
160 | /* set region */ |
157 | region = RP->region; |
161 | default_region = RP->region; |
158 | |
162 | |
159 | CEDE; |
163 | CEDE; |
160 | |
164 | |
161 | /* create walls unless the wallstyle is "none" */ |
165 | /* create walls unless the wallstyle is "none" */ |
162 | if (strcmp (RP->wallstyle, "none")) |
166 | if (strcmp (RP->wallstyle, "none")) |
… | |
… | |
164 | make_map_walls (this, layout, RP->wallstyle, RP); |
168 | make_map_walls (this, layout, RP->wallstyle, RP); |
165 | |
169 | |
166 | /* place doors unless doorstyle or wallstyle is "none" */ |
170 | /* place doors unless doorstyle or wallstyle is "none" */ |
167 | if (strcmp (RP->doorstyle, "none")) |
171 | if (strcmp (RP->doorstyle, "none")) |
168 | put_doors (this, layout, RP->doorstyle, RP); |
172 | put_doors (this, layout, RP->doorstyle, RP); |
169 | |
|
|
170 | } |
173 | } |
171 | |
174 | |
172 | CEDE; |
175 | CEDE; |
173 | |
176 | |
174 | /* create exits unless the exitstyle is "none" */ |
177 | /* create exits unless the exitstyle is "none" */ |
… | |
… | |
641 | void |
644 | void |
642 | write_map_parameters_to_string (char *buf, random_map_params *RP) |
645 | write_map_parameters_to_string (char *buf, random_map_params *RP) |
643 | { |
646 | { |
644 | char small_buf[16384]; |
647 | char small_buf[16384]; |
645 | |
648 | |
646 | sprintf (buf, "xsize %d\nysize %d\n", RP->Xsize, RP->Ysize); |
649 | sprintf (buf, "xsize %d\nysize %d\n", RP->xsize, RP->ysize); |
647 | |
650 | |
648 | if (RP->wallstyle[0]) |
651 | if (RP->wallstyle[0]) |
649 | { |
652 | { |
650 | sprintf (small_buf, "wallstyle %s\n", RP->wallstyle); |
653 | sprintf (small_buf, "wallstyle %s\n", RP->wallstyle); |
651 | strcat (buf, small_buf); |
654 | strcat (buf, small_buf); |
… | |
… | |
792 | strcat (buf, small_buf); |
795 | strcat (buf, small_buf); |
793 | } |
796 | } |
794 | |
797 | |
795 | if (RP->random_seed) |
798 | if (RP->random_seed) |
796 | { |
799 | { |
797 | sprintf (small_buf, "random_seed %d\n", RP->random_seed); |
800 | sprintf (small_buf, "random_seed %u\n", RP->random_seed); |
798 | strcat (buf, small_buf); |
801 | strcat (buf, small_buf); |
799 | } |
802 | } |
800 | |
803 | |
801 | if (RP->custom) |
804 | if (RP->custom) |
802 | { |
805 | { |
… | |
… | |
828 | int dungeon_level_n, |
831 | int dungeon_level_n, |
829 | int difficulty_n, |
832 | int difficulty_n, |
830 | int difficulty_given_n, |
833 | int difficulty_given_n, |
831 | int decoroptions_n, |
834 | int decoroptions_n, |
832 | int orientation_n, |
835 | int orientation_n, |
833 | int origin_x_n, int origin_y_n, int random_seed_n, int treasureoptions_n, float difficulty_increase) |
836 | int origin_x_n, int origin_y_n, uint32_t random_seed_n, int treasureoptions_n, float difficulty_increase) |
834 | { |
837 | { |
835 | char small_buf[16384]; |
838 | char small_buf[16384]; |
836 | |
839 | |
837 | sprintf (buf, "xsize %d\nysize %d\n", xsize_n, ysize_n); |
840 | sprintf (buf, "xsize %d\nysize %d\n", xsize_n, ysize_n); |
838 | |
841 | |
… | |
… | |
974 | } |
977 | } |
975 | |
978 | |
976 | if (random_seed_n) |
979 | if (random_seed_n) |
977 | { |
980 | { |
978 | /* Add one so that the next map is a bit different */ |
981 | /* Add one so that the next map is a bit different */ |
979 | sprintf (small_buf, "random_seed %d\n", random_seed_n + 1); |
982 | sprintf (small_buf, "random_seed %u\n", random_seed_n + 1); |
980 | strcat (buf, small_buf); |
983 | strcat (buf, small_buf); |
981 | } |
984 | } |
982 | |
985 | |
983 | if (treasureoptions_n) |
986 | if (treasureoptions_n) |
984 | { |
987 | { |