Пример #1
0
void update_map_collide(SlabKind slbkind, MapSubtlCoord stl_x, MapSubtlCoord stl_y)
{
    struct Map *mapblk;
    mapblk = get_map_block_at(stl_x, stl_y);
    struct Column *colmn;
    colmn = get_map_column(mapblk);
    if (column_invalid(colmn)) {
        ERRORLOG("Invalid column at (%d,%d)",(int)stl_x,(int)stl_y);
    }
    unsigned long smask;
    smask = colmn->solidmask;
    MapSubtlCoord stl_z;
    for (stl_z=0; stl_z < map_subtiles_z; stl_z++)
    {
        if ((smask & 0x01) == 0)
            break;
        smask >>= 1;
    }
    struct SlabAttr *slbattr;
    slbattr = get_slab_kind_attrs(slbkind);
    unsigned long nflags;
    if (slbattr->field_2 < stl_z) {
      nflags = slbattr->block_flags;
    } else {
      nflags = slbattr->noblck_flags;
    }
    mapblk->flags &= (SlbAtFlg_Unk80|SlbAtFlg_Unk04);
    mapblk->flags |= nflags;
}
Пример #2
0
/**
 * Returns amount of filled subtiles at bottom of column at given coords.
 * @param stl_x Subtile for which column height should be returned, X coord.
 * @param stl_y Subtile for which column height should be returned, Y coord.
 */
long get_floor_filled_subtiles_at(MapSubtlCoord stl_x, MapSubtlCoord stl_y)
{
    const struct Column *col;
    col = get_column_at(stl_x, stl_y);
    if (column_invalid(col))
        return 0;
    return (col->bitfields & 0xF0) >> 4;
}
Пример #3
0
/**
 * Returns amount of filled subtiles at bottom of column at given map block.
 * @param mapblk The map block for which column height should be returned.
 */
long get_map_floor_filled_subtiles(const struct Map *mapblk)
{
    const struct Column *col;
    col = get_map_column(mapblk);
    if (column_invalid(col))
        return 0;
    return (col->bitfields & 0xF0) >> 4;
}
Пример #4
0
/**
 * Returns amount of filled subtiles at top of column at given coords.
 * @param stl_x Subtile for which column height should be returned, X coord.
 * @param stl_y Subtile for which column height should be returned, Y coord.
 */
long get_ceiling_filled_subtiles_at(MapSubtlCoord stl_x, MapSubtlCoord stl_y)
{
    const struct Column *colmn;
    colmn = get_column_at(stl_x, stl_y);
    if (column_invalid(colmn))
        return 0;
    return (colmn->bitfields & 0x0E) >> 1;
}
Пример #5
0
/**
 * Returns amount of filled subtiles at top of column at given map block.
 * @param mapblk The map block for which column height should be returned.
 */
long get_map_ceiling_filled_subtiles(const struct Map *mapblk)
{
    const struct Column *col;
    col = get_map_column(mapblk);
    if (column_invalid(col))
        return 0;
    return (col->bitfields & 0x0E) >> 1;
}
Пример #6
0
/**
 * Sets amount of filled subtiles at top of a column at given map block.
 * @param mapblk The map block for which filled height should be set.
 * @param n Amount of subtiles.
 */
void set_map_ceiling_filled_subtiles(struct Map *mapblk, MapSubtlCoord n)
{
    struct Column *col;
    col = get_map_column(mapblk);
    if (column_invalid(col))
        return;
    col->bitfields &= ~0x0E;
    col->bitfields |= (n<<1) & 0x0E;
}