56 if (mode < 1 || mode > 4) {
67 for (i = 1; i < RP->
Xsize; i++)
68 for (j = 1; j < RP->
Ysize; j++) {
69 if (layout[i][j] == target) {
79 for (i = RP->
Xsize-2; i > 0; i--)
80 for (j = 1; j < RP->
Ysize-1; j++) {
81 if (layout[i][j] == target) {
91 for (i = 1; i < RP->
Xsize-1; i++)
92 for (j = RP->
Ysize-2; j > 0; j--) {
93 if (layout[i][j] == target) {
103 for (i = RP->
Xsize-2; i > 0; i--)
104 for (j = RP->
Ysize-2; j > 0; j--) {
105 if (layout[i][j] == target) {
146 char styledirname[256];
149 object *the_exit_down;
153 int cx = -1, cy = -1;
154 int upx = -1, upy = -1;
155 int downx = -1, downy = -1;
156 int final_map_exit = 1;
163 if (orientation == 0) {
164 orientation =
RANDOM()%6+1;
167 switch (orientation) {
169 snprintf(styledirname,
sizeof(styledirname),
"/styles/exitstyles/up");
170 style_map_up =
find_style(styledirname, exitstyle, -1);
171 snprintf(styledirname,
sizeof(styledirname),
"/styles/exitstyles/down");
172 style_map_down =
find_style(styledirname, exitstyle, -1);
177 snprintf(styledirname,
sizeof(styledirname),
"/styles/exitstyles/down");
178 style_map_up =
find_style(styledirname, exitstyle, -1);
179 snprintf(styledirname,
sizeof(styledirname),
"/styles/exitstyles/up");
180 style_map_down =
find_style(styledirname, exitstyle, -1);
185 snprintf(styledirname,
sizeof(styledirname),
"/styles/exitstyles/generic");
186 style_map_up =
find_style(styledirname, exitstyle, -1);
187 style_map_down = style_map_up;
192 if (style_map_up == NULL) {
205 }
else if (style_map_down == NULL) {
214 the_exit_down = NULL;
230 if (upx == -1 && cx != -1) {
231 if (cx > RP->
Xsize/2) {
236 if (cy > RP->
Ysize/2) {
243 if (upx == 1 && upy == 1) {
245 }
else if (upx == 1 && upy > 1) {
247 }
else if (upx > 1 && upy == 1) {
249 }
else if (upx > 1 && upy > 1) {
260 for (j = 1; j < 9; j++) {
273 maze[upx][upy] =
'<';
290 if (upx > RP->
Xsize/2) {
295 if (upy > RP->
Ysize/2) {
302 if (downx == 1 && downy == 1) {
304 }
else if (downx == 1 && downy > 1) {
306 }
else if (downx > 1 && downy == 1) {
308 }
else if (downx > 1 && downy > 1) {
354 if (final_map_exit == 1) {
357 the_exit_back->
stats.
hp = downx+freearr_x[i];
358 the_exit_back->
stats.
sp = downy+freearr_y[i];
370 maze[the_exit_down->
x][the_exit_down->
y] =
'>';
389 for (i = 0; i < RP->
Xsize; i++)
390 for (j = 0; j < RP->
Ysize; j++)
391 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 place_exits(mapstruct *map, char **maze, char *exitstyle, int orientation, RMParms *RP)
void object_update(object *op, int action)
object * pick_random_object(mapstruct *style)
short freearr_y[SIZEOFFREE]
void unblock_exits(mapstruct *map, char **maze, RMParms *RP)
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 * create_archetype(const char *name)
void find_in_layout(int mode, char target, int *fx, int *fy, char **layout, RMParms *RP)
StringBuffer * write_map_parameters_to_string(const RMParms *RP)
#define MOVE_BLOCK_DEFAULT
int object_find_first_free_spot(const object *ob, mapstruct *m, int x, int y)
int wall_blocked(mapstruct *m, int x, int y)
sstring add_string(const char *str)
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
mapstruct * find_style(const char *dirname, const char *stylename, int difficulty)
void object_set_msg(object *op, const char *msg)
object * arch_to_object(archetype *at)
char * stringbuffer_finish(StringBuffer *sb)
void object_remove(object *op)