Index: class.doc ================================================================== --- class.doc +++ class.doc @@ -1204,11 +1204,14 @@ Advance the number in the direction as though it is a X coordinate. If the direction is north or south, leaves it alone, but if it is east or west then it is increased or decreased by one. The output is never less than zero nor exceeding the playfield width by more than one. -NewY ( oldx dir -- newy ) +NewXY ( oldx oldy dir -- newx newy ) + NewX and NewY together. + +NewY ( oldy dir -- newy ) Advance the number in the direction as though it is a Y coordinate. nip ( x y -- y ) o? ( any -- bool ) @@ -1366,10 +1369,13 @@ ,XDir ( obj dir -- newx ) Finds the X coordinate of the cell in the specified direction of the specified object. +XYDir ( dir -- newx newy ) + Finds the X and Y coordinates of the cell in the given direction. + YDir ( dir -- newy ) Finds the Y coordinate of the cell in the given direction. ,YDir ( obj dir -- newy ) Finds the Y coordinate of the cell in the specified direction of the Index: exec.c ================================================================== --- exec.c +++ exec.c @@ -1479,10 +1479,11 @@ case OP_MUL: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.u*t2.u)); break; case OP_MUL_C: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(t1.s*t2.s)); break; case OP_NE: StackReq(2,1); t2=Pop(); t1=Pop(); Push(NVALUE(v_equal(t1,t2)?0:1)); break; case OP_NEG: StackReq(1,1); t1=Pop(); Numeric(t1); t1.s=-t1.s; Push(t1); break; case OP_NEWX: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(new_x(t1.u,t2.u))); break; + case OP_NEWXY: StackReq(3,1); t3=Pop(); Numeric(t3); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(new_x(t1.u,t3.u))); Push(NVALUE(new_y(t2.u,t3.u))); break; case OP_NEWY: StackReq(2,1); t2=Pop(); Numeric(t2); t1=Pop(); Numeric(t1); Push(NVALUE(new_y(t1.u,t2.u))); break; case OP_NEXT: StackReq(0,1); ptr=v_next(code,ptr); break; case OP_NIP: StackReq(2,1); t1=Pop(); Pop(); Push(t1); break; case OP_OBJABOVE: StackReq(0,1); i=obj_above(obj); Push(OVALUE(i)); break; case OP_OBJABOVE_C: StackReq(1,1); i=obj_above(v_object(Pop())); Push(OVALUE(i)); break; @@ -1587,10 +1588,11 @@ case OP_WINLEVEL: key_ignored=0; gameover=1; Throw(0); break; case OP_XDIR: StackReq(1,1); t1=Pop(); Numeric(t1); Push(NVALUE(o->x+x_delta[resolve_dir(obj,t1.u)])); break; case OP_XDIR_C: StackReq(2,1); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i==VOIDLINK) Push(NVALUE(0)); else Push(NVALUE(objects[i]->x+x_delta[resolve_dir(i,t1.u)])); break; case OP_XLOC: StackReq(0,1); Push(NVALUE(o->x)); break; case OP_XLOC_C: StackReq(1,1); Push(GetVariableOf(x,NVALUE)); break; + case OP_XYDIR: StackReq(1,2); t1=Pop(); Numeric(t1); i=resolve_dir(obj,t1.u); Push(NVALUE(o->x+x_delta[i])); Push(NVALUE(o->y+y_delta[i])); break; case OP_YDIR: StackReq(1,1); t1=Pop(); Numeric(t1); Push(NVALUE(o->y+y_delta[resolve_dir(obj,t1.u)])); break; case OP_YDIR_C: StackReq(2,1); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i==VOIDLINK) Push(NVALUE(0)); else Push(NVALUE(objects[i]->y+y_delta[resolve_dir(i,t1.u)])); break; case OP_YLOC: StackReq(0,1); Push(NVALUE(o->y)); break; case OP_YLOC_C: StackReq(1,1); Push(GetVariableOf(y,NVALUE)); break; #define MiscVar(a,b) \ Index: instruc ================================================================== --- instruc +++ instruc @@ -221,10 +221,11 @@ MaxInventory ; error if more than that many slots in inventory .,Move .,MovePlus "Move+" ; obj.Inertia+=Strength instead of obj.Inertia=Strength .,MoveTo ; the internal MoveTo() function NewX +NewXY NewY ,ObjAbove ,ObjBelow ObjBottomAt ObjClassAt @@ -241,10 +242,11 @@ Synchronize Trace VolumeAt WinLevel ,XDir +XYDir ,YDir ; Specials *Function *Local Index: instruc.h ================================================================== --- instruc.h +++ instruc.h @@ -325,48 +325,50 @@ #define OP_MOVETO 32920 #define OP_MOVETO_C 34968 #define OP_MOVETO_D 41112 #define OP_MOVETO_CD 43160 #define OP_NEWX 32921 -#define OP_NEWY 32922 -#define OP_OBJABOVE 32923 -#define OP_OBJABOVE_C 34971 -#define OP_OBJBELOW 32924 -#define OP_OBJBELOW_C 34972 -#define OP_OBJBOTTOMAT 32925 -#define OP_OBJCLASSAT 32926 -#define OP_OBJDIR 32927 -#define OP_OBJDIR_C 34975 -#define OP_OBJLAYERAT 32928 -#define OP_OBJTOPAT 32929 -#define OP_POPUP 32930 -#define OP_POPUPARGS 32931 -#define OP_QUEUETURN 32932 -#define OP_SEND 32933 -#define OP_SEND_C 34981 -#define OP_SEND_D 41125 -#define OP_SEND_CD 43173 -#define OP_SENDEX 32934 -#define OP_SENDEX_C 34982 -#define OP_SENDEX_D 41126 -#define OP_SENDEX_CD 43174 -#define OP_SETINVENTORY 32935 -#define OP_SOUND 32936 -#define OP_SYNCHRONIZE 32937 -#define OP_TRACE 32938 -#define OP_VOLUMEAT 32939 -#define OP_WINLEVEL 32940 -#define OP_XDIR 32941 -#define OP_XDIR_C 34989 -#define OP_YDIR 32942 -#define OP_YDIR_C 34990 -#define OP_FUNCTION 32943 -#define OP_LOCAL 32944 -#define OP_LABEL 32945 -#define OP_STRING 32946 -#define OP_INT16 32947 -#define OP_INT32 32948 +#define OP_NEWXY 32922 +#define OP_NEWY 32923 +#define OP_OBJABOVE 32924 +#define OP_OBJABOVE_C 34972 +#define OP_OBJBELOW 32925 +#define OP_OBJBELOW_C 34973 +#define OP_OBJBOTTOMAT 32926 +#define OP_OBJCLASSAT 32927 +#define OP_OBJDIR 32928 +#define OP_OBJDIR_C 34976 +#define OP_OBJLAYERAT 32929 +#define OP_OBJTOPAT 32930 +#define OP_POPUP 32931 +#define OP_POPUPARGS 32932 +#define OP_QUEUETURN 32933 +#define OP_SEND 32934 +#define OP_SEND_C 34982 +#define OP_SEND_D 41126 +#define OP_SEND_CD 43174 +#define OP_SENDEX 32935 +#define OP_SENDEX_C 34983 +#define OP_SENDEX_D 41127 +#define OP_SENDEX_CD 43175 +#define OP_SETINVENTORY 32936 +#define OP_SOUND 32937 +#define OP_SYNCHRONIZE 32938 +#define OP_TRACE 32939 +#define OP_VOLUMEAT 32940 +#define OP_WINLEVEL 32941 +#define OP_XDIR 32942 +#define OP_XDIR_C 34990 +#define OP_XYDIR 32943 +#define OP_YDIR 32944 +#define OP_YDIR_C 34992 +#define OP_FUNCTION 32945 +#define OP_LOCAL 32946 +#define OP_LABEL 32947 +#define OP_STRING 32948 +#define OP_INT16 32949 +#define OP_INT32 32950 #ifdef HEROMESH_CLASS static const Op_Names op_names[]={ {"*",8486935}, {"+",8421397}, {"-",8421398}, @@ -499,29 +501,30 @@ {"Msg",8421488}, {"N",9437186}, {"NE",9437185}, {"NW",9437187}, {"NewX",8421529}, -{"NewY",8421530}, +{"NewXY",8421530}, +{"NewY",8421531}, {"OLDPHONE",8389402}, {"ONCE",8388609}, {"OSC",8388616}, {"OSCLOOP",8388618}, -{"ObjAbove",8487067}, -{"ObjBelow",8487068}, -{"ObjBottomAt",8421533}, -{"ObjClassAt",8421534}, -{"ObjDir",8487071}, -{"ObjLayerAt",8421536}, -{"ObjTopAt",8421537}, +{"ObjAbove",8487068}, +{"ObjBelow",8487069}, +{"ObjBottomAt",8421534}, +{"ObjClassAt",8421535}, +{"ObjDir",8487072}, +{"ObjLayerAt",8421537}, +{"ObjTopAt",8421538}, {"PLAYERMOVING",8389133}, {"POSTINIT",8389138}, {"POUR",8389377}, {"POWER",8389386}, {"Player",8487020}, -{"PopUp",8421538}, -{"QueueTurn",8421540}, +{"PopUp",8421539}, +{"QueueTurn",8421541}, {"Quiz",8683642}, {"R",9437198}, {"RATCHET1",8389418}, {"RATCHET2",8389412}, {"RATTLE",8389403}, @@ -535,44 +538,45 @@ {"STOP",8388608}, {"SUBS",8683647}, {"SUNK",8389131}, {"SW",9437189}, {"Self",8421487}, -{"Send",10584229}, -{"SendEx",10584230}, -{"SetInventory",8421543}, +{"Send",10584230}, +{"SendEx",10584231}, +{"SetInventory",8421544}, {"Shape",8618039}, {"ShapeDir",8618062}, {"Sharp",8618061}, {"Shovable",8618063}, -{"Sound",8421544}, +{"Sound",8421545}, {"Stealthy",8618088}, {"Strength",9142346}, -{"Synchronize",8421545}, +{"Synchronize",8421546}, {"TAHTASHH",8389409}, {"THMP_thmp",8389405}, {"THWIT",8389384}, {"TICK",8389391}, {"Temperature",9142325}, -{"Trace",8421546}, +{"Trace",8421547}, {"UH_OH",8389382}, {"UNCORK",8389414}, {"UNHH",8389381}, {"UserSignal",8618085}, {"UserState",8618086}, {"VACUUM",8389411}, {"VisualOnly",8618087}, {"Volume",9142338}, -{"VolumeAt",8421547}, +{"VolumeAt",8421548}, {"W",9437188}, {"WAHOO",8389400}, {"WHACK",8389423}, {"Weight",9142340}, -{"WinLevel",8421548}, -{"XDir",8487085}, +{"WinLevel",8421549}, +{"XDir",8487086}, +{"XYDir",8421551}, {"Xloc",8486968}, -{"YDir",8487086}, +{"YDir",8487088}, {"YEEHAW",8389401}, {"Yloc",8486969}, {"again",8683532}, {"band",8421405}, {"begin",8683531}, @@ -648,7 +652,7 @@ {"then",8683529}, {"tuck",8421380}, {"until",8683533}, {"while",8683534}, }; -#define N_OP_NAMES 282 +#define N_OP_NAMES 284 #endif