Exemplo n.º 1
0
static void _doc_process_var(doc_ptr doc, cptr name)
{
    if (strcmp(name, "version") == 0)
    {
        string_ptr s = string_alloc_format("%d.%d.%d", VER_MAJOR, VER_MINOR, VER_PATCH);
        doc_insert(doc, string_buffer(s));
        string_free(s);
    }
    else if (strlen(name) > 3 && strncmp(name, "FF_", 3) == 0)
    {
        char buf[100];
        int  f_idx;

        sprintf(buf, "%s", name + 3);
        f_idx = f_tag_to_index(buf);

        if (0 <= f_idx && f_idx < max_f_idx)
        {
            string_ptr s = string_alloc();
            feature_type *feat = &f_info[f_idx];

            string_printf(s, "<color:%c>%c</color>",
                attr_to_attr_char(feat->d_attr[F_LIT_STANDARD]),
                feat->d_char[F_LIT_STANDARD]);

            doc_insert(doc, string_buffer(s));
            string_free(s);
        }
    }
}
Exemplo n.º 2
0
/*
 * Builds the arena after it is entered -KMW-
 */
static void build_battle(void)
{
	int yval, y_height, y_depth, xval, x_left, x_right;
	register int i, j;

	yval = SCREEN_HGT / 2;
	xval = SCREEN_WID / 2;
	y_height = yval - 10;
	y_depth = yval + 10;
	x_left = xval - 32;
	x_right = xval + 32;

	for (i = y_height; i <= y_height + 5; i++)
		for (j = x_left; j <= x_right; j++)
		{
			place_extra_perm_bold(i, j);
			cave[i][j].info |= (CAVE_GLOW | CAVE_MARK);
		}
	for (i = y_depth; i >= y_depth - 3; i--)
		for (j = x_left; j <= x_right; j++)
		{
			place_extra_perm_bold(i, j);
			cave[i][j].info |= (CAVE_GLOW | CAVE_MARK);
		}
	for (j = x_left; j <= x_left + 17; j++)
		for (i = y_height; i <= y_depth; i++)
		{
			place_extra_perm_bold(i, j);
			cave[i][j].info |= (CAVE_GLOW | CAVE_MARK);
		}
	for (j = x_right; j >= x_right - 17; j--)
		for (i = y_height; i <= y_depth; i++)
		{
			place_extra_perm_bold(i, j);
			cave[i][j].info |= (CAVE_GLOW | CAVE_MARK);
		}

	place_extra_perm_bold(y_height+6, x_left+18);
	cave[y_height+6][x_left+18].info |= (CAVE_GLOW | CAVE_MARK);
	place_extra_perm_bold(y_depth-4, x_left+18);
	cave[y_depth-4][x_left+18].info |= (CAVE_GLOW | CAVE_MARK);
	place_extra_perm_bold(y_height+6, x_right-18);
	cave[y_height+6][x_right-18].info |= (CAVE_GLOW | CAVE_MARK);
	place_extra_perm_bold(y_depth-4, x_right-18);
	cave[y_depth-4][x_right-18].info |= (CAVE_GLOW | CAVE_MARK);

	for (i = y_height + 1; i <= y_height + 5; i++)
		for (j = x_left + 20 + 2 * (y_height + 5 - i); j <= x_right - 20 - 2 * (y_height + 5 - i); j++)
		{
			cave[i][j].feat = feat_permanent_glass_wall;
		}

	i = y_height + 1;
	j = xval;
	cave[i][j].feat = f_tag_to_index("BUILDING_3");
	cave[i][j].info |= (CAVE_GLOW | CAVE_MARK);
	player_place(i, j);
}
/*
 * Builds the arena after it is entered -KMW-
 */
static void build_arena(void)
{
    int yval, y_height, y_depth, xval, x_left, x_right;
    register int i, j;

    yval = SCREEN_HGT / 2;
    xval = SCREEN_WID / 2;
    y_height = yval - 10;
    y_depth = yval + 10;
    x_left = xval - 32;
    x_right = xval + 32;

    for (i = y_height; i <= y_height + 5; i++)
        for (j = x_left; j <= x_right; j++)
        {
            place_extra_perm_bold(i, j);
            cave[i][j].info |= (CAVE_GLOW | CAVE_MARK | CAVE_AWARE);
        }
    for (i = y_depth; i >= y_depth - 5; i--)
        for (j = x_left; j <= x_right; j++)
        {
            place_extra_perm_bold(i, j);
            cave[i][j].info |= (CAVE_GLOW | CAVE_MARK | CAVE_AWARE);
        }
    for (j = x_left; j <= x_left + 17; j++)
        for (i = y_height; i <= y_depth; i++)
        {
            place_extra_perm_bold(i, j);
            cave[i][j].info |= (CAVE_GLOW | CAVE_MARK | CAVE_AWARE);
        }
    for (j = x_right; j >= x_right - 17; j--)
        for (i = y_height; i <= y_depth; i++)
        {
            place_extra_perm_bold(i, j);
            cave[i][j].info |= (CAVE_GLOW | CAVE_MARK | CAVE_AWARE);
        }

    place_extra_perm_bold(y_height+6, x_left+18);
    cave[y_height+6][x_left+18].info |= (CAVE_GLOW | CAVE_MARK | CAVE_AWARE);
    place_extra_perm_bold(y_depth-6, x_left+18);
    cave[y_depth-6][x_left+18].info |= (CAVE_GLOW | CAVE_MARK | CAVE_AWARE);
    place_extra_perm_bold(y_height+6, x_right-18);
    cave[y_height+6][x_right-18].info |= (CAVE_GLOW | CAVE_MARK | CAVE_AWARE);
    place_extra_perm_bold(y_depth-6, x_right-18);
    cave[y_depth-6][x_right-18].info |= (CAVE_GLOW | CAVE_MARK | CAVE_AWARE);

    i = y_height + 5;
    j = xval;
    cave[i][j].feat = f_tag_to_index("ARENA_GATE");
    cave[i][j].info |= (CAVE_GLOW | CAVE_MARK | CAVE_AWARE);
    player_place(i, j);
}
/*
 * Builds the arena after it is entered -KMW-
 */
static void build_battle(void)
{
    int yval, y_height, y_depth, xval, x_left, x_right;
    register int i, j;

    yval = SCREEN_HGT / 2;
    xval = SCREEN_WID / 2;
    y_height = yval - 10;
    y_depth = yval + 10;
    x_left = xval - 32;
    x_right = xval + 32;

    /* Hack: Move the arena down 5 lines so that messages do not
       obstruct the battle. Couldn't this be read from a file just
       like vaults/rooms in v_info?*/
    y_height += 5;
    y_depth += 5;
    for (i = 0; i < y_height; i++)
        for (j = x_left; j <= x_right; j++)
        {
            place_extra_perm_bold(i, j);
            cave[i][j].info |= (CAVE_GLOW | CAVE_MARK);
        }


    for (i = y_height; i <= y_height + 5; i++)
        for (j = x_left; j <= x_right; j++)
        {
            place_extra_perm_bold(i, j);
            cave[i][j].info |= (CAVE_GLOW | CAVE_MARK);
        }
    for (i = y_depth; i >= y_depth - 3; i--)
        for (j = x_left; j <= x_right; j++)
        {
            place_extra_perm_bold(i, j);
            cave[i][j].info |= (CAVE_GLOW | CAVE_MARK);
        }
    for (j = x_left; j <= x_left + 17; j++)
        for (i = y_height; i <= y_depth; i++)
        {
            place_extra_perm_bold(i, j);
            cave[i][j].info |= (CAVE_GLOW | CAVE_MARK);
        }
    for (j = x_right; j >= x_right - 17; j--)
        for (i = y_height; i <= y_depth; i++)
        {
            place_extra_perm_bold(i, j);
            cave[i][j].info |= (CAVE_GLOW | CAVE_MARK);
        }

    place_extra_perm_bold(y_height+6, x_left+18);
    cave[y_height+6][x_left+18].info |= (CAVE_GLOW | CAVE_MARK);
    place_extra_perm_bold(y_depth-4, x_left+18);
    cave[y_depth-4][x_left+18].info |= (CAVE_GLOW | CAVE_MARK);
    place_extra_perm_bold(y_height+6, x_right-18);
    cave[y_height+6][x_right-18].info |= (CAVE_GLOW | CAVE_MARK);
    place_extra_perm_bold(y_depth-4, x_right-18);
    cave[y_depth-4][x_right-18].info |= (CAVE_GLOW | CAVE_MARK);

    for (i = y_height + 1; i <= y_height + 5; i++)
        for (j = x_left + 20 + 2 * (y_height + 5 - i); j <= x_right - 20 - 2 * (y_height + 5 - i); j++)
        {
            cave[i][j].feat = feat_permanent_glass_wall;
        }

    i = y_height + 1;
    j = xval;
    cave[i][j].feat = f_tag_to_index("BUILDING_3");
    cave[i][j].info |= (CAVE_GLOW | CAVE_MARK);
    player_place(i, j);
}