예제 #1
0
void set_thing_draw(struct Thing *thing, long anim, long speed, long scale, char a5, char start_frame, unsigned char draw_class)
{
    unsigned long i;
    thing->anim_sprite = convert_td_iso(anim);
    thing->field_50 &= 0x03;
    thing->field_50 |= (draw_class << 2);
    thing->field_49 = keepersprite_frames(thing->anim_sprite);
    if (speed != -1) {
        thing->field_3E = speed;
    }
    if (scale != -1) {
        thing->sprite_size = scale;
    }
    if (a5 != -1) {
        set_flag_byte(&thing->field_4F, TF4F_Unknown40, a5);
    }
    if (start_frame == -2)
    {
        i = keepersprite_frames(thing->anim_sprite) - 1;
        thing->field_48 = i;
        thing->field_40 = i << 8;
    } else if (start_frame == -1)
    {
        i = ACTION_RANDOM(thing->field_49);
        thing->field_48 = i;
        thing->field_40 = i << 8;
    } else
    {
        i = start_frame;
        thing->field_48 = i;
        thing->field_40 = i << 8;
    }
}
예제 #2
0
void set_sprite_view_isometric(void)
{
    //_DK_set_sprite_view_isometric();
    long i;
    for (i=1; i < THINGS_COUNT; i++)
    {
        struct Thing *thing;
        thing = thing_get(i);
        if (thing_exists(thing))
        {
            if (thing_is_creature(thing) || ((thing->field_4F & 0x01) == 0))
            {
                int n;
                n = straight_td_iso(thing->field_44);
                if (n >= 0)
                {
                    thing->field_44 = n;
                    long nframes;
                    nframes = keepersprite_frames(thing->field_44);
                    if (nframes != thing->field_49)
                    {
                        ERRORLOG("No frames different between views C%d, M%d, A%d, B%d",thing->class_id,thing->model,thing->field_49,nframes);
                        thing->field_49 = nframes;
                        n = thing->field_49 - 1;
                        if (n > thing->field_48) {
                            n = thing->field_48;
                        }
                        thing->field_48 = n;
                        thing->field_40 = n << 8;
                    }
                }
            }
        }
    }
}
예제 #3
0
void set_sprite_view_3d(void)
{
    long i;
    for (i=1; i < THINGS_COUNT; i++)
    {
        struct Thing *thing;
        thing = thing_get(i);
        if (thing_exists(thing))
        {
            if (thing_is_creature(thing) || ((thing->field_4F & TF4F_DoNotDraw) == 0))
            {
                int n;
                n = straight_iso_td(thing->anim_sprite);
                if (n >= 0)
                {
                    thing->anim_sprite = n;
                    long nframes;
                    nframes = keepersprite_frames(thing->anim_sprite);
                    if (nframes != thing->field_49)
                    {
                        ERRORLOG("No frames different between views C%d, M%d, A%d, B%d",thing->class_id,thing->model,thing->field_49,nframes);
                        thing->field_49 = nframes;
                        n = thing->field_49 - 1;
                        if (n > thing->field_48) {
                            n = thing->field_48;
                        }
                        thing->field_48 = n;
                        thing->field_40 = n << 8;
                    }
                }
            }
        }
    }
}
예제 #4
0
long get_lifespan_of_animation(long ani, long frameskip)
{
    return (keepersprite_frames(ani) << 8) / frameskip;
}