Index: class.doc ================================================================== --- class.doc +++ class.doc @@ -675,10 +675,11 @@ JUMPED KEY LASTIMAGE MOVED MOVING + NEXTWARP PLAYERMOVING POSTINIT SUNK Input constants: @@ -2369,10 +2370,16 @@ it is the first pass of checking if it can be moved due to Connection; in that case, if all first passes are successful then it will try again the second pass with From set to the first object of the group, and this second time they will actually be moved. +NEXTWARP + Sent to the warp object if a warp fails. From is the same as it is for + HITBY, Arg1 is the direction of movement, and Arg3 is the hit value. + Return zero to not try again, or an object to try again with a new + warp object. + PLAYERMOVING If an object with the Player flag is about to move, then after the MOVING message is sent, PLAYERMOVING is sent to all objects. From is the object which is moving, Arg1 and Arg2 are where it will be moved to, and Arg3 is the From of the MOVING message. If the return value is true, Index: exec.c ================================================================== --- exec.c +++ exec.c @@ -1490,11 +1490,17 @@ if(hit&0x20000) goto success; if(move_to(from,obj,objects[objLF]->x,objects[objLF]->y)) goto success; } } } - fail: if(hit&0x1000) goto success; o->inertia=0; return 0; + fail: + if(hit&0x1000) goto success; + if(hit&0x10000000) { + v=send_message(obj,objW,MSG_NEXTWARP,NVALUE(dir),NVALUE(0),NVALUE(hit)); + if(v.t || v.u) goto warp; + } + o->inertia=0; return 0; success: if(!(hit&0x4000)) o->oflags|=OF_MOVED; if(hit&0x10000000) o->dir=dir; return 1; } static int jump_to(Uint32 from,Uint32 n,Uint32 x,Uint32 y) { int xx,yy; Index: heromesh.h ================================================================== --- heromesh.h +++ heromesh.h @@ -36,11 +36,11 @@ #define ZVALUE(x) UVALUE(x,TY_STRING) #define OVALUE(x) ((x)==VOIDLINK?NVALUE(0):UVALUE(x,objects[x]->generation)) #define ValueTo64(v) (((sqlite3_int64)((v).u))|(((sqlite3_int64)((v).t))<<32)) #define ValueEq(x,y) ((x).t==(y).t && (x).u==(y).u) -#define N_MESSAGES 26 +#define N_MESSAGES 27 extern const char*const standard_message_names[]; extern const char*const standard_sound_names[]; extern const char*const heromesh_key_names[256]; extern sqlite3*userdb; Index: instruc.h ================================================================== --- instruc.h +++ instruc.h @@ -652,10 +652,11 @@ {"Moved",8618101}, {"Moving",8618102}, {"Msg",8421502}, {"N",9437186}, {"NE",9437185}, +{"NEXTWARP",8389146}, {"NW",9437187}, {"NewX",8421566}, {"NewXY",8421567}, {"NewY",8421568}, {"OLDPHONE",8389402}, @@ -846,7 +847,7 @@ {"tuck",8421380}, {"uniq",8421607}, {"until",8683534}, {"while",8683535}, }; -#define N_OP_NAMES 360 +#define N_OP_NAMES 361 #endif Index: names.h ================================================================== --- names.h +++ names.h @@ -23,10 +23,11 @@ #define MSG_COLLIDEBY 21 #define MSG_COLLIDE 22 #define MSG_COLLIDING 23 #define MSG_BLOCKED 24 #define MSG_CONNECT 25 +#define MSG_NEXTWARP 26 #ifdef HEROMESH_MAIN const char*const standard_message_names[]={ "INIT", "CREATE", "DESTROY", @@ -51,10 +52,11 @@ "COLLIDEBY", "COLLIDE", "COLLIDING", "BLOCKED", "CONNECT", + "NEXTWARP", }; #endif #define SND_SPLASH 0 #define SND_POUR 1 #define SND_DOOR 2 Index: names.js ================================================================== --- names.js +++ names.js @@ -28,10 +28,11 @@ 21 = COLLIDEBY 22 = COLLIDE 23 = COLLIDING 24 = BLOCKED 25 = CONNECT + 26 = NEXTWARP `.split("\n").map(x=>/^ *([0-9]+) = ([^ ]*) *$/.exec(x)).filter(x=>x); const standard_sound_names=[]; ` SPLASH POUR