Index: TODO ================================================================== --- TODO +++ TODO @@ -47,11 +47,11 @@ * Multiuser scoring within one computer system (optional capability) * Testing * Bizarro world * Connection movement (it is partially tested, already) * Sweep, SweepEx, HitMe - * Overriding order of execution + * Overriding order of execution (partially tested) * Conversion from other games * DOS Hero Hearts * Berusky * PC Wanderer * Escape Index: class.c ================================================================== --- class.c +++ class.c @@ -2209,11 +2209,10 @@ static void parse_order_block(void) { // OP_MISC1, OP_MISC1_C, etc = properties (_C=reverse) // 0x1000...0x10FF = Have flag // OP_RET = end of block Uint16 beg,ptr; - if(!main_options['U']) ParseError("Experimental/unstable feature\n"); //TODO: remove this when it is implemented properly in exec.c too orders=malloc(0x4000*sizeof(Uint16)); if(!orders) fatal("Allocation failed\n"); nxttok(); if(tokent==TF_INT) { if(tokenv<1 || tokenv>254) ParseError("Order number out of range\n"); Index: exec.c ================================================================== --- exec.c +++ exec.c @@ -723,20 +723,21 @@ static void set_order(Uint32 obj) { // To avoid confusing order of execution at the wrong time, // calling this function is limited to only certain times. Object*o=objects[obj]; - Uint8 ord=classes[objects[obj]->class]->order; + Uint8 ord=classes[o->class]->order; Uint8 u; Sint32 v0,v1; - Uint16 p=orders[ord]+1; + Uint16 p; Uint32 n=firstobj; for(;;) { if(n==obj || n==VOIDLINK) goto notfound; u=classes[objects[n]->class]->order; - if(uoflags&OF_ORDERED)) goto found; if(u==ord) { + p=orders[ord]+1; criteria: switch(orders[p]) { case OP_RET: goto found; case OP_DENSITY: v0=o->density; v1=objects[n]->density; goto compare; case OP_DENSITY_C: v1=o->density; v0=objects[n]->density; goto compare; case OP_IMAGE: v0=o->image; v1=objects[n]->image; goto compare; @@ -802,19 +803,16 @@ n=objects[n]->next; } found: // Now it has been found; insert this object previous to the found object, removing from its existing slot. // (Objects are executed in reverse order, so previous in the linked list means executed next) - if(firstobj==obj) firstobj=o->next; - if(lastobj==obj) lastobj=o->prev; - if(o->prev!=VOIDLINK) objects[o->prev]->next=o->next; - if(o->next!=VOIDLINK) objects[o->next]->prev=o->prev; + if(o->prev==VOIDLINK) firstobj=o->next; else objects[o->prev]->next=o->next; + if(o->next==VOIDLINK) lastobj=o->prev; else objects[o->next]->prev=o->prev; + o->next=n; o->prev=objects[n]->prev; - o->next=n; objects[n]->prev=obj; - if(o->prev==VOIDLINK) firstobj=obj; - if(objects[n]->next==VOIDLINK) lastobj=n; + if(o->prev==VOIDLINK) firstobj=obj; else objects[o->prev]->next=obj; notfound: objects[obj]->oflags|=OF_ORDERED; } static Uint32 create(Uint32 from,Uint16 c,Uint32 x,Uint32 y,Uint32 im,Uint32 d) {