public short tileToShort(Tile t)
    {
        short res = 0;

        if (t.tileNum != -1)
            res |= (short) ((t.tileNum + tileOffset) & 0x3FF);
        res |= (short) ((t.hflip ? 1 : 0) << 10);
        res |= (short) ((t.vflip ? 1 : 0) << 11);
        res |= (short) (((t.palNum + paletteOffset) & 0x00F) << 12);

        return res;
    }