66 if (mode < 1 || mode > 4)
76 for (i = 1; i < RP->
Xsize; i++)
77 for (j = 1; j < RP->
Ysize; j++) {
78 if (layout[i][j] == target) {
88 for (i = RP->
Xsize-2; i > 0; i--)
89 for (j = 1; j < RP->
Ysize-1; j++) {
90 if (layout[i][j] == target) {
100 for (i = 1; i < RP->
Xsize-1; i++)
101 for (j = RP->
Ysize-2; j > 0; j--) {
102 if (layout[i][j] == target) {
112 for (i = RP->
Xsize-2; i > 0; i--)
113 for (j = RP->
Ysize-2; j > 0; j--) {
114 if (layout[i][j] == target) {
154 char styledirname[256];
157 object *the_exit_down;
161 int cx = -1, cy = -1;
162 int upx = -1, upy = -1;
163 int downx = -1, downy = -1;
164 int final_map_exit = 1;
172 if (orientation == 0)
173 orientation = RANDOM()%6+1;
175 switch (orientation) {
177 snprintf(styledirname,
sizeof(styledirname),
"/styles/exitstyles/up");
178 style_map_up =
find_style(styledirname, exitstyle, -1);
179 snprintf(styledirname,
sizeof(styledirname),
"/styles/exitstyles/down");
180 style_map_down =
find_style(styledirname, exitstyle, -1);
185 snprintf(styledirname,
sizeof(styledirname),
"/styles/exitstyles/down");
186 style_map_up =
find_style(styledirname, exitstyle, -1);
187 snprintf(styledirname,
sizeof(styledirname),
"/styles/exitstyles/up");
188 style_map_down =
find_style(styledirname, exitstyle, -1);
193 snprintf(styledirname,
sizeof(styledirname),
"/styles/exitstyles/generic");
194 style_map_up =
find_style(styledirname, exitstyle, -1);
195 style_map_down = style_map_up;
200 if (style_map_up == NULL)
213 else if (style_map_down == NULL)
222 the_exit_down = NULL;
237 if (upx == -1 && cx != -1) {
238 if (cx > RP->
Xsize/2)
242 if (cy > RP->
Ysize/2)
248 if (upx == 1 && upy == 1)
250 else if (upx == 1 && upy > 1)
252 else if (upx > 1 && upy == 1)
254 else if (upx > 1 && upy > 1)
262 the_exit_up->
x = upx;
263 the_exit_up->
y = upy;
266 for (j = 1; j < 9; j++) {
282 maze[the_exit_up->
x][the_exit_up->
y] =
'<';
299 if (upx > RP->
Xsize/2)
303 if (upy > RP->
Ysize/2)
309 if (downx == 1 && downy == 1)
311 else if (downx == 1 && downy > 1)
313 else if (downx > 1 && downy == 1)
315 else if (downx > 1 && downy > 1)
359 if (final_map_exit == 1) {
362 the_exit_back->
stats.
hp = the_exit_down->
x;
363 the_exit_back->
stats.
sp = the_exit_down->
y;
377 maze[the_exit_down->
x][the_exit_down->
y] =
'>';
396 for (i = 0; i < RP->
Xsize; i++)
397 for (j = 0; j < RP->
Ysize; j++)
398 if (maze[i][j] ==
'>' || maze[i][j] ==
'<') {
void set_map_timeout(mapstruct *oldmap)
char final_exit_archetype[RM_SIZE]
archetype * find_archetype(const char *name)
mapstruct * ready_map_name(const char *name, int flags)
char exit_on_final_map[RM_SIZE]
short freearr_x[SIZEOFFREE]
void update_object(object *op, int action)
void place_exits(mapstruct *map, char **maze, char *exitstyle, int orientation, RMParms *RP)
object * pick_random_object(mapstruct *style)
short freearr_y[SIZEOFFREE]
void unblock_exits(mapstruct *map, char **maze, RMParms *RP)
void remove_ob(object *op)
object * create_archetype(const char *name)
void write_map_parameters_to_string(RMParms *RP, char *buf, int bufsize)
int find_first_free_spot(const object *ob, mapstruct *m, int x, int y)
void find_in_layout(int mode, char target, int *fx, int *fy, char **layout, RMParms *RP)
object * insert_ob_in_map(object *op, mapstruct *m, object *originator, int flag)
#define MOVE_BLOCK_DEFAULT
int wall_blocked(mapstruct *m, int x, int y)
int snprintf(char *dest, int max, const char *format,...)
sstring add_string(const char *str)
#define GET_MAP_OB(M, X, Y)
mapstruct * find_style(const char *dirname, const char *stylename, int difficulty)
void free_object(object *ob)
object * arch_to_object(archetype *at)