Index: exec.c ================================================================== --- exec.c +++ exec.c @@ -35,10 +35,12 @@ Inventory*inventory; Uint32 ninventory; char**levelstrings; Uint16 nlevelstrings; Value*array_data; +Uint16 ndeadanim; +DeadAnimation*deadanim; typedef struct { Uint16 msg; Uint32 from; Value arg1,arg2,arg3; @@ -158,17 +160,34 @@ free(o); return VOIDLINK; } #define animfree free + +static void set_dead_animation(const Object*o) { + DeadAnimation*d; + deadanim=realloc(deadanim,(ndeadanim+1)*sizeof(DeadAnimation)); + if(!deadanim) fatal("Allocation failed\n"); + d=deadanim+ndeadanim++; + d->class=o->class; + d->x=o->x; + d->y=o->y; + d->s=o->anim->step[o->anim->vstep]; + d->vtime=o->anim->vtime; + d->vimage=o->anim->vimage; +} void objtrash(Uint32 n) { Object*o=objects[n]; if(!o) return; - if(n==traced_obj.u && o->generation==traced_obj.t && main_options['t'] && !main_options['e']) { - printf("# Object traced at (%d,%d)\n",o->x,o->y); - Throw("Object traced"); + if(!main_options['e']) { + if(n==traced_obj.u && o->generation==traced_obj.t && main_options['t']) { + printf("# Object traced at (%d,%d)\n",o->x,o->y); + Throw("Object traced"); + } else if(ndeadanim<0x1000 && o->anim && o->anim->status==ANISTAT_VISUAL && !(o->oflags&OF_INVISIBLE)) { + if(o->up==VOIDLINK || (objects[o->up]->oflags&OF_DESTROYED)) set_dead_animation(o); + } } animfree(o->anim); if(o->down==VOIDLINK) playfield[o->x+o->y*64-65]=o->up; else objects[o->down]->up=o->up; if(o->up!=VOIDLINK) objects[o->up]->down=o->down; @@ -1794,10 +1813,13 @@ objects=0; gameover=0; clear_inventory(); for(i=0;ianim; Index: game.c ================================================================== --- game.c +++ game.c @@ -134,10 +134,11 @@ static void continue_animation(void) { Uint32 n=firstobj; Object*o; Animation*a; + DeadAnimation*d; int i; for(i=0;i<8;i++) if(anim_slot[i].length && ++anim_slot[i].vtime==anim_slot[i].speed && (anim_slot[i].vtime=0,++anim_slot[i].frame==anim_slot[i].length)) anim_slot[i].frame=0; while(n!=VOIDLINK) { o=objects[n]; if((a=o->anim) && (a->status&ANISTAT_VISUAL)) { @@ -171,10 +172,28 @@ } draw_cell(o->x,o->y); } } n=o->next; + } + if(ndeadanim) { + for(i=0;ix,d->y); + if(!d->s.flag) continue; + if(d->vimageclass]->nimages) + draw_picture((d->x-1)*picture_size+left_margin,(d->y-1)*picture_size,classes[d->class]->images[d->vimage]&0x7FFF); + if(++d->vtime>=d->s.speed) { + if(d->vimage==d->s.end) d->s.flag=0; + if(d->s.end>=d->s.start) ++d->vimage; else --d->vimage; + } + } + for(i=0;i