… | |
… | |
28 | char **map_gen_spiral(int xsize, int ysize, int option); |
28 | char **map_gen_spiral(int xsize, int ysize, int option); |
29 | */ |
29 | */ |
30 | |
30 | |
31 | #include <global.h> |
31 | #include <global.h> |
32 | #include <random_map.h> |
32 | #include <random_map.h> |
|
|
33 | #include <rproto.h> |
33 | |
34 | |
34 | #define RANDOM_OPTIONS 0 /* Pick random options below */ |
35 | #define RANDOM_OPTIONS 0 /* Pick random options below */ |
35 | #define REGULAR_SPIRAL 1 /* Regular spiral--distance increases constantly */ |
36 | #define REGULAR_SPIRAL 1 /* Regular spiral--distance increases constantly */ |
36 | #define FINE_SPIRAL 2 /* uses the min. separation: most coiling */ |
37 | #define FINE_SPIRAL 2 /* uses the min. separation: most coiling */ |
37 | #define FIT_SPIRAL 4 /* scale to a rectangular region, not square */ |
38 | #define FIT_SPIRAL 4 /* scale to a rectangular region, not square */ |
38 | #define MAX_SPIRAL_OPT 8 /* this should be 2x the last real option */ |
39 | #define MAX_SPIRAL_OPT 8 /* this should be 2x the last real option */ |
39 | #include <math.h> |
|
|
40 | |
|
|
41 | #ifndef MIN |
|
|
42 | # define MIN(x,y) (((x)<(y))? (x):(y)) |
|
|
43 | #endif |
|
|
44 | #ifndef MAX |
|
|
45 | # define MAX(x,y) (((x)<(y))? (y):(x)) |
|
|
46 | #endif |
|
|
47 | |
40 | |
48 | #define MINDIST 3 |
41 | #define MINDIST 3 |
49 | |
42 | |
50 | #define MAX_FINE .454545 |
43 | #define MAX_FINE .454545 |
51 | |
44 | |
… | |
… | |
107 | yscale *= (float) ysize / (float) xsize; |
100 | yscale *= (float) ysize / (float) xsize; |
108 | } |
101 | } |
109 | |
102 | |
110 | if (option & REGULAR_SPIRAL) |
103 | if (option & REGULAR_SPIRAL) |
111 | { |
104 | { |
112 | float scale = MIN (xscale, yscale); |
105 | float scale = min (xscale, yscale); |
113 | |
106 | |
114 | xscale = yscale = scale; |
107 | xscale = yscale = scale; |
115 | } |
108 | } |
116 | |
109 | |
117 | /* cut out the spiral */ |
110 | /* cut out the spiral */ |