Ejemplo n.º 1
0
/*
 * try not to put in room NR
 */
void
put_player(short nr)
{
    short rn = nr, misses;
    short row, col;

    for (misses = 0; ((misses < 2) && (rn == nr)); misses++) {
        gr_row_col(&row, &col, (FLOOR | TUNNEL | OBJECT | STAIRS));
        rn = get_room_number(row, col);
    }
    rogue.row = row;
    rogue.col = col;

    if (dungeon[rogue.row][rogue.col] & TUNNEL) {
        cur_room = PASSAGE;
    } else {
        cur_room = rn;
    }
    if (cur_room != PASSAGE) {
        light_up_room(cur_room);
    } else {
        light_passage(rogue.row, rogue.col);
    }
    rn = get_room_number(rogue.row, rogue.col);
    wake_room(rn, 1, rogue.row, rogue.col);
    if (new_level_message) {
        messagef(0, "%s", new_level_message);
        new_level_message = NULL;
    }
    mvaddch(rogue.row, rogue.col, rogue.fchar);
}
void
wanderer(void)
{
	object *monster;
	short row, col, i;
	boolean found = 0;

	monster = NULL;		/* XXXGCC -Wuninitialized [powerpc] */

	for (i = 0; ((i < 15) && (!found)); i++) {
		monster = gr_monster(NULL, 0);
		if (!(monster->m_flags & (WAKENS | WANDERS))) {
			free_object(monster);
		} else {
			found = 1;
		}
	}
	if (found) {
		found = 0;
		wake_up(monster);
		for (i = 0; ((i < 25) && (!found)); i++) {
			gr_row_col(&row, &col, (FLOOR | TUNNEL | STAIRS | OBJECT));
			if (!rogue_can_see(row, col)) {
				put_m_at(row, col, monster);
				found = 1;
			}
		}
		if (!found) {
			free_object(monster);
		}
	}
}
Ejemplo n.º 3
0
void
add_traps(void)
{
    short i, n, tries = 0;
    short row, col;

    if (cur_level <= 2) {
	n = 0;
    } else if (cur_level <= 7) {
	n = get_rand(0, 2);
    } else if (cur_level <= 11) {
	n = get_rand(1, 2);
    } else if (cur_level <= 16) {
	n = get_rand(2, 3);
    } else if (cur_level <= 21) {
	n = get_rand(2, 4);
    } else if (cur_level <= (AMULET_LEVEL + 2)) {
	n = get_rand(3, 5);
    } else {
	n = get_rand(5, MAX_TRAPS);
    }
    for (i = 0; i < n; i++) {
	traps[i].trap_type = get_rand(0, (TRAPS - 1));

	if ((i == 0) && (party_room != NO_ROOM)) {
	    do {
		row = get_rand((rooms[party_room].top_row + 1),
			       (rooms[party_room].bottom_row - 1));
		col = get_rand((rooms[party_room].left_col + 1),
			       (rooms[party_room].right_col - 1));
		tries++;
	    } while (((dungeon[row][col] & (OBJECT | STAIRS | TRAP | TUNNEL))
		      || (dungeon[row][col] == NOTHING)) && (tries < 15));
	    if (tries >= 15) {
		gr_row_col(&row, &col, (FLOOR | MONSTER));
	    }
	} else {
	    gr_row_col(&row, &col, (FLOOR | MONSTER));
	}
	traps[i].trap_row = row;
	traps[i].trap_col = col;
	dungeon[row][col] |= (TRAP | HIDDEN);
    }
}
void
put_mons(void)
{
	short i;
	short n;
	object *monster;
	short row, col;

	n = get_rand(4, 6);

	for (i = 0; i < n; i++) {
		monster = gr_monster(NULL, 0);
		if ((monster->m_flags & WANDERS) && coin_toss()) {
			wake_up(monster);
		}
		gr_row_col(&row, &col, (FLOOR | TUNNEL | STAIRS | OBJECT));
		put_m_at(row, col, monster);
	}
}
Ejemplo n.º 5
0
void wanderer(void)
{
    object *monster;
    int row, col;
    int	i;
    boolean found = 0;

    for (i = 0; ((i < 15) && (!found)); i++)
    {
        monster = gr_monster((object *) 0, 0);
        if (!(monster->m_flags & (WAKENS | WANDERS)))
        {
            free_object(monster);
        }
        else
        {
            found = 1;
        }
    }
    if (found)
    {
        found = 0;
        wake_up(monster);
        for (i = 0; ((i < 25) && (!found)); i++)
        {
            gr_row_col(&row, &col, (FLOOR | TUNNEL | STAIRS | OBJECT));
            if (!rogue_can_see(row, col))
            {
                put_m_at(row, col, monster);
                found = 1;
            }
        }
        if (!found)
        {
            free_object(monster);
        }
    }
}