Unify random light state for rooms or level

This commit is contained in:
Pasi Kallinen
2020-01-05 13:31:24 +02:00
parent 5292ab5de0
commit cedc757e16
3 changed files with 14 additions and 8 deletions
+1
View File
@@ -1301,6 +1301,7 @@ E void FDECL(mineralize, (int, int, int, int, BOOLEAN_P));
E void FDECL(flood_fill_rm, (int, int, int, BOOLEAN_P, BOOLEAN_P)); E void FDECL(flood_fill_rm, (int, int, int, BOOLEAN_P, BOOLEAN_P));
E void FDECL(remove_rooms, (int, int, int, int)); E void FDECL(remove_rooms, (int, int, int, int));
E boolean FDECL(litstate_rnd, (int));
/* E void FDECL(mkmap, (lev_init *)); -- need sp_lev.h for lev_init */ /* E void FDECL(mkmap, (lev_init *)); -- need sp_lev.h for lev_init */
/* ### mkmaze.c ### */ /* ### mkmaze.c ### */
+10 -2
View File
@@ -446,6 +446,15 @@ unsigned roomno;
#define N_P2_ITER 1 /* tune map generation via this value */ #define N_P2_ITER 1 /* tune map generation via this value */
#define N_P3_ITER 2 /* tune map smoothing via this value */ #define N_P3_ITER 2 /* tune map smoothing via this value */
boolean
litstate_rnd(litstate)
int litstate;
{
if (litstate < 0)
return (rnd(1 + abs(depth(&u.uz))) < 11 && rn2(77)) ? TRUE : FALSE;
return (boolean) litstate;
}
void void
mkmap(init_lev) mkmap(init_lev)
lev_init *init_lev; lev_init *init_lev;
@@ -455,8 +464,7 @@ lev_init *init_lev;
xchar lit = init_lev->lit, walled = init_lev->walled; xchar lit = init_lev->lit, walled = init_lev->walled;
int i; int i;
if (lit < 0) lit = litstate_rnd(lit);
lit = (rnd(1 + abs(depth(&u.uz))) < 11 && rn2(77)) ? 1 : 0;
g.new_locations = (char *) alloc((WIDTH + 1) * HEIGHT); g.new_locations = (char *) alloc((WIDTH + 1) * HEIGHT);
+3 -6
View File
@@ -705,8 +705,7 @@ xchar rtype, rlit;
/* some other rooms may require lighting */ /* some other rooms may require lighting */
/* is light state random ? */ /* is light state random ? */
if (rlit == -1) rlit = litstate_rnd(rlit);
rlit = (rnd(1 + abs(depth(&u.uz))) < 11 && rn2(77)) ? TRUE : FALSE;
/* /*
* Here we will try to create a room. If some parameters are * Here we will try to create a room. If some parameters are
@@ -886,8 +885,7 @@ xchar rtype, rlit;
y++; y++;
if (rtype == -1) if (rtype == -1)
rtype = OROOM; rtype = OROOM;
if (rlit == -1) rlit = litstate_rnd(rlit);
rlit = (rnd(1 + abs(depth(&u.uz))) < 11 && rn2(77)) ? TRUE : FALSE;
add_subroom(proom, proom->lx + x, proom->ly + y, proom->lx + x + w - 1, add_subroom(proom, proom->lx + x, proom->ly + y, proom->lx + x + w - 1,
proom->ly + y + h - 1, rlit, rtype, FALSE); proom->ly + y + h - 1, rlit, rtype, FALSE);
return TRUE; return TRUE;
@@ -4827,8 +4825,7 @@ lua_State *L;
return 0; return 0;
} }
if (rlit < 0) rlit = litstate_rnd(rlit);
rlit = (rnd(1 + abs(depth(&u.uz))) < 11 && rn2(77)) ? TRUE : FALSE;
get_location(&dx1, &dy1, ANY_LOC, (struct mkroom *) 0); get_location(&dx1, &dy1, ANY_LOC, (struct mkroom *) 0);
get_location(&dx2, &dy2, ANY_LOC, (struct mkroom *) 0); get_location(&dx2, &dy2, ANY_LOC, (struct mkroom *) 0);