Esempio n. 1
0
void mkswamp(void)
{			       // Michiel Huisjes & Fred de Wilde
    struct mkroom *sroom;
    int sx, sy, i, eelct = 0;

    for (i = 0; i < 5; i++) {  // 5 tries
	sroom = &rooms[rn2(nroom)];
	if (sroom->hx < 0 || sroom->rtype || has_upstairs(sroom) || has_dnstairs(sroom))
	    continue;

	// satisfied; make a swamp
	sroom->rtype = SWAMP;
	for (sx = sroom->lx; sx <= sroom->hx; sx++)
	    for (sy = sroom->ly; sy <= sroom->hy; sy++)
		if ((sx + sy) % 2 && !o_at(sx, sy) && !t_at(sx, sy)
		    && !m_at(sx, sy) && !nexttodoor(sx, sy)) {
		    levl[sx][sy].typ = POOL;
		    levl[sx][sy].scrsym = POOL_SYM;
		    if (!eelct || !rn2(4)) {
			(void) makemon(PM_EEL, sx, sy);
			eelct++;
		    }
		}
    }
}
Esempio n. 2
0
static void
mkswamp(struct level *lev)
{
    struct mkroom *sroom;
    int sx, sy, i, eelct = 0;

    for (i = 0; i < 5; i++) {   /* turn up to 5 rooms swampy */
        sroom = &lev->rooms[rn2(lev->nroom)];
        if (sroom->hx < 0 || sroom->rtype != OROOM || has_upstairs(lev, sroom)
            || has_dnstairs(lev, sroom))
            continue;

        /* satisfied; make a swamp */
        sroom->rtype = SWAMP;
        for (sx = sroom->lx; sx <= sroom->hx; sx++)
            for (sy = sroom->ly; sy <= sroom->hy; sy++)
                if (!OBJ_AT_LEV(lev, sx, sy) && !MON_AT(lev, sx, sy) &&
                    !t_at(lev, sx, sy) && !nexttodoor(lev, sx, sy)) {
                    if ((sx + sy) % 2) {
                        lev->locations[sx][sy].typ = POOL;
                        if (!eelct || !rn2(4)) {
                            /* mkclass() won't do, as we might get kraken */
                            makemon(rn2(5) ? &mons[PM_GIANT_EEL]
                                    : rn2(2) ? &mons[PM_PIRANHA]
                                    : &mons[PM_ELECTRIC_EEL], lev, sx, sy,
                                    NO_MM_FLAGS);
                            eelct++;
                        }
                    } else if (!rn2(4)) /* swamps tend to be moldy */
                        makemon(mkclass(&lev->z, S_FUNGUS, 0), lev, sx, sy,
                                NO_MM_FLAGS);
                }
        lev->flags.has_swamp = 1;
    }
}