Index: class.doc ================================================================== --- class.doc +++ class.doc @@ -1059,12 +1059,17 @@ enough to do so (whether or not the other thing has a Connection flag). Shovable : int16 [c] Defines what directions the object may be shoved, where bit0 means east, bit2 means north, bit4 means west, and bit6 means south. Bit1, bit3, - bit5, and bit7 can be used for diagonal shoving. Higher bits are - reserved for future and should not be used. + bit5, and bit7 can be used for diagonal shoving. Higher bits are used + for connection movement, if the Connection flag is also set; each bit + which is set makes it connect to an object in that direction which has + the same CollisionLayers value, the bit in the Shovable high 8-bits for + the opposite direction, and the Connection flag. If the Connection flag + is not set, then you can use the high bits of Shovable for your own use, + since the game engine will not use them in that case. Stealthy : bool [c] If this flag is set, then the Arrived and Departed variables of other objects are not automatically set when this object moves. Index: exec.c ================================================================== --- exec.c +++ exec.c @@ -986,10 +986,25 @@ conn[nconn].id=nconn; // used for stable sorting conn[nconn].visual=(o->oflags&OF_VISUALONLY)?1:0; o->oflags|=OF_MOVING|OF_VISUALONLY; nconn++; } + +static void add_connection_shov(Object*o) { + int i,x,y; + Uint8 b=classes[o->class]->collisionLayers; + Uint32 n; + for(i=0;i<8;i++) if(o->shovable&(0x100<x+x_delta[i]; y=o->y+y_delta[i]; + if(x<1 || x>pfwidth || y<1 || y>pfheight) continue; + n=playfield[x+y*64-65]; + while(n!=VOIDLINK) { + if(classes[objects[n]->class]->collisionLayers==b && (objects[n]->shovable&(0x100<<(4^i)))) add_connection(n); + n=objects[n]->up; + } + } +} static int fake_move_dir(Uint32 obj,Uint32 dir,Uint8 no) { // This is similar to move_dir, but specialized for the HIT/HITBY processing in connected_move. // Note that this may result in calling the real move_dir due to shoving. Object*o; @@ -1162,13 +1177,15 @@ if(nconn!=pconn) Throw("Improper nested connected move"); // Find and add all connections add_connection(obj); for(i=first;iinertia=inertia; + o=objects[n=conn[i].obj]; + o->inertia=inertia; if(v_bool(send_message(obj,n,MSG_CONNECT,NVALUE(i-first),NVALUE(dir),NVALUE(weight)))) goto fail; - weight+=objects[n]->weight; + weight+=o->weight; + if(o->shovable&0xFF00) add_connection_shov(o); } if(conn_option&0x01) { for(i=first;iinertia