Пример #1
0
static void _decode_page(BITBUFFER *bb, BD_IG_PAGE *p)
{
    unsigned ii;

    p->id      = bb_read(bb, 8);
    p->version = bb_read(bb, 8);

    _decode_uo_mask_table(bb, &p->uo_mask_table);

    _decode_effect_sequence(bb, &p->in_effects);
    _decode_effect_sequence(bb, &p->out_effects);

    p->animation_frame_rate_code       = bb_read(bb, 8);
    p->default_selected_button_id_ref  = bb_read(bb, 16);
    p->default_activated_button_id_ref = bb_read(bb, 16);
    p->palette_id_ref                  = bb_read(bb, 8);

    p->num_bogs = bb_read(bb, 8);
    p->bog      = calloc(p->num_bogs, sizeof(BD_IG_BOG));

    for (ii = 0; ii < p->num_bogs; ii++) {
        _decode_bog(bb, &p->bog[ii]);
    }
}
Пример #2
0
static int _decode_page(BITBUFFER *bb, BD_IG_PAGE *p)
{
    unsigned ii;

    p->id      = bb_read(bb, 8);
    p->version = bb_read(bb, 8);

    _decode_uo_mask_table(bb, &p->uo_mask_table);

    if (!_decode_effect_sequence(bb, &p->in_effects)) {
        return 0;
    }
    if (!_decode_effect_sequence(bb, &p->out_effects)) {
        return 0;
    }

    p->animation_frame_rate_code       = bb_read(bb, 8);
    p->default_selected_button_id_ref  = bb_read(bb, 16);
    p->default_activated_button_id_ref = bb_read(bb, 16);
    p->palette_id_ref                  = bb_read(bb, 8);

    p->num_bogs = bb_read(bb, 8);
    p->bog      = calloc(p->num_bogs, sizeof(BD_IG_BOG));
    if (!p->bog) {
        BD_DEBUG(DBG_DECODE | DBG_CRIT, "out of memory\n");
        return 0;
    }

    for (ii = 0; ii < p->num_bogs; ii++) {
        if (!_decode_bog(bb, &p->bog[ii])) {
            return 0;
        }
    }

    return 1;
}