Index: exec.c ================================================================== --- exec.c +++ exec.c @@ -144,14 +144,26 @@ return n; bad: free(o); return VOIDLINK; } + +#define animfree free void objtrash(Uint32 n) { Object*o=objects[n]; if(!o) return; + if(o->anim && !(o->oflags&(OF_INVISIBLE|OF_BIZARRO))) { + //TODO: Check that the animation is actually playing + // If there is an animation, continue to display it, but let it have no effect on the game behaviour + // This may happen if the LASTIMAGE message destroys the object. + o->oflags=OF_DESTROYED|OF_STEALTHY|OF_VISUALONLY; + o->generation=0; + //TODO + return; + } + 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; o->down=o->up=VOIDLINK; if(firstobj==n) firstobj=o->next; @@ -160,10 +172,15 @@ if(o->next!=VOIDLINK) objects[o->next]->prev=o->prev; free(o); objects[n]=0; generation_number_inc=1; } + +static void animate(Uint32 n,Uint32 f,Uint32 a0,Uint32 a1,Uint32 t) { + objects[n]->image=a0; + //TODO +} static Uint32 obj_above(Uint32 i) { Object*o; if(i==VOIDLINK) return VOIDLINK; o=objects[i]; @@ -369,10 +386,11 @@ case 0x3800 ... 0x38FF: NoIgnore(); StackReq(1,0); globals[code[ptr-1]&0x7FF]=Pop(); break; case 0x4000 ... 0x7FFF: StackReq(0,1); Push(CVALUE(code[ptr-1]-0x4000)); break; case 0x87E8 ... 0x87FF: StackReq(0,1); Push(NVALUE(1UL<<(code[ptr-1]&31))); break; case 0xC000 ... 0xFFFF: StackReq(0,1); Push(MVALUE((code[ptr-1]&0x3FFF)+256)); break; case OP_ADD: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.u+t2.u)); break; + case OP_ANIMATE: StackReq(4,0); t4=Pop(); Numeric(t4); t3=Pop(); Numeric(t3); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); animate(obj,t1.u,t2.u,t3.u,t4.u); break; case OP_BAND: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.u&t2.u)); break; case OP_BNOT: StackReq(1,1); t1=Pop(); Numeric(t1); Push(NVALUE(~t1.u)); break; case OP_BOR: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.u|t2.u)); break; case OP_BROADCAST: StackReq(4,1); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); Push(v_broadcast(obj,t1,t2,t3,t4,NVALUE(0),0)); break; case OP_BROADCAST_D: StackReq(4,0); t4=Pop(); t3=Pop(); t2=Pop(); t1=Pop(); v_broadcast(obj,t1,t2,t3,t4,NVALUE(0),0); break; @@ -529,11 +547,14 @@ void annihilate(void) { Uint32 i; for(i=0;i<64*64;i++) playfield[i]=VOIDLINK; firstobj=lastobj=VOIDLINK; if(!objects) return; - for(i=0;ianim); + free(objects[i]); + } nobjects=0; free(objects); objects=0; gameover=0; } Index: heromesh.h ================================================================== --- heromesh.h +++ heromesh.h @@ -165,10 +165,15 @@ void init_sql_functions(sqlite3_int64*ptr0,sqlite3_int64*ptr1); // == exec == #define VOIDLINK ((Uint32)(-1)) + +#define ANI_STOP 0x00 +#define ANI_ONCE 0x01 +#define ANI_LOOP 0x02 +#define ANI_OSC 0x08 typedef struct { //TODO } Animation;