本家#481
in sp_lev.c, split maze grid and solid filling level inits into their own functi
ons, prepping for future changes.
@@ -95,8 +95,34 @@ | ||
95 | 95 | lev_region *lregions = 0; |
96 | 96 | int num_lregions = 0; |
97 | 97 | |
98 | +void | |
99 | +lvlfill_maze_grid(x1,y1,x2,y2,filling) | |
100 | + int x1,y1,x2,y2; | |
101 | + schar filling; | |
102 | +{ | |
103 | + int x,y; | |
98 | 104 | |
105 | + for (x = x1; x <= x2; x++) | |
106 | + for (y = y1; y <= y2; y++) { | |
107 | +#ifndef WALLIFIED_MAZE | |
108 | + levl[x][y].typ = STONE; | |
109 | +#else | |
110 | + levl[x][y].typ = | |
111 | + (y < 2 || ((x % 2) && (y % 2))) ? STONE : filling; | |
112 | +#endif | |
113 | + } | |
114 | +} | |
99 | 115 | |
116 | +void | |
117 | +lvlfill_solid(filling) | |
118 | + schar filling; | |
119 | +{ | |
120 | + int x,y; | |
121 | + for (x = 2; x <= x_maze_max; x++) | |
122 | + for (y = 0; y <= y_maze_max; y++) | |
123 | + levl[x][y].typ = filling; | |
124 | +} | |
125 | + | |
100 | 126 | void flip_drawbridge_horizontal(lev) |
101 | 127 | struct rm *lev; |
102 | 128 | { |
@@ -2693,18 +2719,10 @@ | ||
2693 | 2719 | if (lvl->init_lev.lit < 0) lvl->init_lev.lit = rn2(2); |
2694 | 2720 | mkmap(&(lvl->init_lev)); |
2695 | 2721 | } else { |
2696 | - for(x = 2; x <= x_maze_max; x++) | |
2697 | - for(y = 0; y <= y_maze_max; y++) | |
2698 | - if (lvl->init_lev.filling == -1) { | |
2699 | -#ifndef WALLIFIED_MAZE | |
2700 | - levl[x][y].typ = STONE; | |
2701 | -#else | |
2702 | - levl[x][y].typ = | |
2703 | - (y < 2 || ((x % 2) && (y % 2))) ? STONE : HWALL; | |
2704 | -#endif | |
2705 | - } else { | |
2706 | - levl[x][y].typ = lvl->init_lev.filling; | |
2707 | - } | |
2722 | + if (lvl->init_lev.filling == -1) | |
2723 | + lvlfill_maze_grid(2,0, x_maze_max,y_maze_max, HWALL); | |
2724 | + else | |
2725 | + lvlfill_solid(lvl->init_lev.filling); | |
2708 | 2726 | /* ensure the whole level is marked as mapped area */ |
2709 | 2727 | xstart = 1; |
2710 | 2728 | ystart = 0; |