* If there's a significant portion of maze unused by the special level, * we don't want it empty. * * Makes the number of traps, monsters, etc. proportional * to the size of the maze. */
| 2923 | * to the size of the maze. |
| 2924 | */ |
| 2925 | staticfn void |
| 2926 | fill_empty_maze(void) |
| 2927 | { |
| 2928 | int mapcountmax, mapcount, mapfact; |
| 2929 | coordxy x, y; |
| 2930 | coord mm; |
| 2931 | |
| 2932 | mapcountmax = mapcount = (gx.x_maze_max - 2) * (gy.y_maze_max - 2); |
| 2933 | mapcountmax = mapcountmax / 2; |
| 2934 | |
| 2935 | for (x = 2; x < gx.x_maze_max; x++) |
| 2936 | for (y = 0; y < gy.y_maze_max; y++) |
| 2937 | if (SpLev_Map[x][y]) |
| 2938 | mapcount--; |
| 2939 | |
| 2940 | if ((mapcount > (int) (mapcountmax / 10))) { |
| 2941 | mapfact = (int) ((mapcount * 100L) / mapcountmax); |
| 2942 | for (x = rnd((int) (20 * mapfact) / 100); x; x--) { |
| 2943 | maze1xy(&mm, DRY); |
| 2944 | (void) mkobj_at(rn2(2) ? GEM_CLASS : RANDOM_CLASS, mm.x, mm.y, |
| 2945 | TRUE); |
| 2946 | } |
| 2947 | for (x = rnd((int) (12 * mapfact) / 100); x; x--) { |
| 2948 | struct trap *ttmp; |
| 2949 | |
| 2950 | maze1xy(&mm, DRY); |
| 2951 | if ((ttmp = t_at(mm.x, mm.y)) != 0 |
| 2952 | && (is_pit(ttmp->ttyp) || is_hole(ttmp->ttyp))) |
| 2953 | continue; |
| 2954 | (void) mksobj_at(BOULDER, mm.x, mm.y, TRUE, FALSE); |
| 2955 | } |
| 2956 | for (x = rn2(2); x; x--) { |
| 2957 | maze1xy(&mm, DRY); |
| 2958 | (void) makemon(&mons[PM_MINOTAUR], mm.x, mm.y, NO_MM_FLAGS); |
| 2959 | } |
| 2960 | for (x = rnd((int) (12 * mapfact) / 100); x; x--) { |
| 2961 | maze1xy(&mm, DRY); |
| 2962 | (void) makemon((struct permonst *) 0, mm.x, mm.y, NO_MM_FLAGS); |
| 2963 | } |
| 2964 | for (x = rn2((int) (15 * mapfact) / 100); x; x--) { |
| 2965 | maze1xy(&mm, DRY); |
| 2966 | (void) mkgold(0L, mm.x, mm.y); |
| 2967 | } |
| 2968 | for (x = rn2((int) (15 * mapfact) / 100); x; x--) { |
| 2969 | int trytrap; |
| 2970 | |
| 2971 | maze1xy(&mm, DRY); |
| 2972 | trytrap = rndtrap(); |
| 2973 | if (sobj_at(BOULDER, mm.x, mm.y)) |
| 2974 | while (is_pit(trytrap) || is_hole(trytrap)) |
| 2975 | trytrap = rndtrap(); |
| 2976 | (void) maketrap(mm.x, mm.y, trytrap); |
| 2977 | } |
| 2978 | } |
| 2979 | } |
| 2980 | |
| 2981 | staticfn void |
| 2982 | splev_initlev(lev_init *linit) |
no test coverage detected