Index: class.doc ================================================================== --- class.doc +++ class.doc @@ -1967,10 +1967,19 @@ ,XDir ( obj dir -- newx ) Finds the X coordinate of the cell in the specified direction of the specified object. +XStep ( dir -- result ) + Will be -1 or 0 or +1 depending on the direction; this is the X step + difference for the specified direction. If it is a relative direction, + it is relative to the Self object. + +,XStep ( obj dir -- result ) + Similar to XStep but relative directions are relative to the specified + object, instead of necessarily Self. + 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. @@ -1977,10 +1986,19 @@ ,YDir ( obj dir -- newy ) Finds the Y coordinate of the cell in the specified direction of the specified object. +YStep ( dir -- result ) + Will be -1 or 0 or +1 depending on the direction; this is the Y step + difference for the specified direction. If it is a relative direction, + it is relative to the Self object. + +,YStep ( obj dir -- result ) + Similar to YStep but relative directions are relative to the specified + object, instead of necessarily Self. + === Block instructions === These are block flow controls. They include bodies of other instructions. Index: exec.c ================================================================== --- exec.c +++ exec.c @@ -3106,15 +3106,19 @@ 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_XSTEP: StackReq(1,1); t1=Pop(); Numeric(t1); Push(NVALUE(x_delta[resolve_dir(obj,t1.u)])); break; + case OP_XSTEP_C: StackReq(2,1); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i==VOIDLINK) Push(NVALUE(0)); else Push(NVALUE(x_delta[resolve_dir(i,t1.u)])); 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; + case OP_YSTEP: StackReq(1,1); t1=Pop(); Numeric(t1); Push(NVALUE(y_delta[resolve_dir(obj,t1.u)])); break; + case OP_YSTEP_C: StackReq(2,1); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i==VOIDLINK) Push(NVALUE(0)); else Push(NVALUE(y_delta[resolve_dir(i,t1.u)])); break; #define MiscVar(a,b) \ case a: StackReq(0,1); Push(o->b); break; \ case a+0x0800: StackReq(1,1); Push(GetVariableOf(b,)); break; \ case a+0x1000: NoIgnore(); StackReq(1,0); o->b=Pop(); break; \ case a+0x1001: NoIgnore(); StackReq(1,0); t1=Pop(); if(!t1.t) t1.u&=0xFFFF; o->b=t1; break; \ Index: instruc ================================================================== --- instruc +++ instruc @@ -286,12 +286,14 @@ Trigger TriggerAt VolumeAt WinLevel ,XDir +,XStep XYDir ,YDir +,YStep ; Operations with marks mark "_" tmark in Index: instruc.h ================================================================== --- instruc.h +++ instruc.h @@ -425,60 +425,64 @@ #define OP_TRIGGERAT 32981 #define OP_VOLUMEAT 32982 #define OP_WINLEVEL 32983 #define OP_XDIR 32984 #define OP_XDIR_C 35032 -#define OP_XYDIR 32985 -#define OP_YDIR 32986 -#define OP_YDIR_C 35034 -#define OP_MARK 32987 -#define OP_TMARK 32988 -#define OP_IN 32989 -#define OP_NIN 32990 -#define OP_MBEGIN 32991 -#define OP_FLIP 32992 -#define OP_COUNT 32993 -#define OP_CLEAR 32994 -#define OP_UNIQ 32995 -#define OP_ARRAY 32996 -#define OP_GETARRAY 32997 -#define OP_INITARRAY 32998 -#define OP_SETARRAY 32999 -#define OP_ARRAYCELL 33000 -#define OP_ARRAYSLICE 33001 -#define OP_COPYARRAY 33002 -#define OP_DOTPRODUCT 33003 -#define OP_PATTERN 33004 -#define OP_PATTERN_C 35052 -#define OP_PATTERN_E 37100 -#define OP_PATTERN_EC 39148 -#define OP_PATTERNS 33005 -#define OP_PATTERNS_C 35053 -#define OP_PATTERNS_E 37101 -#define OP_PATTERNS_EC 39149 -#define OP_ROOK 33006 -#define OP_BISHOP 33007 -#define OP_QUEEN 33008 -#define OP_CUT 33009 -#define OP_BIZARRO 33010 -#define OP_BIZARRO_C 35058 -#define OP_BIZARRO_E 37106 -#define OP_BIZARRO_EC 39154 -#define OP_BIZARROSWAP 33011 -#define OP_BIZARROSWAP_D 41203 -#define OP_SWAPWORLD 33012 -#define OP_ABSTRACT 33013 -#define OP_SUPER 33014 -#define OP_SUPER_C 35062 -#define OP_FUNCTION 33015 -#define OP_LOCAL 33016 -#define OP_LABEL 33017 -#define OP_STRING 33018 -#define OP_INT16 33019 -#define OP_INT32 33020 -#define OP_DISPATCH 33021 -#define OP_USERFLAG 33022 +#define OP_XSTEP 32985 +#define OP_XSTEP_C 35033 +#define OP_XYDIR 32986 +#define OP_YDIR 32987 +#define OP_YDIR_C 35035 +#define OP_YSTEP 32988 +#define OP_YSTEP_C 35036 +#define OP_MARK 32989 +#define OP_TMARK 32990 +#define OP_IN 32991 +#define OP_NIN 32992 +#define OP_MBEGIN 32993 +#define OP_FLIP 32994 +#define OP_COUNT 32995 +#define OP_CLEAR 32996 +#define OP_UNIQ 32997 +#define OP_ARRAY 32998 +#define OP_GETARRAY 32999 +#define OP_INITARRAY 33000 +#define OP_SETARRAY 33001 +#define OP_ARRAYCELL 33002 +#define OP_ARRAYSLICE 33003 +#define OP_COPYARRAY 33004 +#define OP_DOTPRODUCT 33005 +#define OP_PATTERN 33006 +#define OP_PATTERN_C 35054 +#define OP_PATTERN_E 37102 +#define OP_PATTERN_EC 39150 +#define OP_PATTERNS 33007 +#define OP_PATTERNS_C 35055 +#define OP_PATTERNS_E 37103 +#define OP_PATTERNS_EC 39151 +#define OP_ROOK 33008 +#define OP_BISHOP 33009 +#define OP_QUEEN 33010 +#define OP_CUT 33011 +#define OP_BIZARRO 33012 +#define OP_BIZARRO_C 35060 +#define OP_BIZARRO_E 37108 +#define OP_BIZARRO_EC 39156 +#define OP_BIZARROSWAP 33013 +#define OP_BIZARROSWAP_D 41205 +#define OP_SWAPWORLD 33014 +#define OP_ABSTRACT 33015 +#define OP_SUPER 33016 +#define OP_SUPER_C 35064 +#define OP_FUNCTION 33017 +#define OP_LOCAL 33018 +#define OP_LABEL 33019 +#define OP_STRING 33020 +#define OP_INT16 33021 +#define OP_INT32 33022 +#define OP_DISPATCH 33023 +#define OP_USERFLAG 33024 #ifdef HEROMESH_CLASS static const Op_Names op_names[]={ {"*",8486943}, {"+",8421405}, {"+Move",10584250}, @@ -487,19 +491,19 @@ {"-rot",8421382}, {".",10518528}, {"/",8486944}, {"ANHH",8389394}, {"ARRIVED",8389124}, -{"Abstract",8683765}, +{"Abstract",8683767}, {"Animate",8552596}, {"AnimateDead",8552597}, {"Arg1",8552576}, {"Arg2",8552577}, {"Arg3",8552578}, -{"Array",8683748}, -{"ArrayCell",8421608}, -{"ArraySlice",8421609}, +{"Array",8683750}, +{"ArrayCell",8421610}, +{"ArraySlice",8421611}, {"Arrivals",8618092}, {"Arrived",8618090}, {"Assassinate",8487062}, {"B",9437196}, {"BANG",8389380}, @@ -512,13 +516,13 @@ {"BRRREEET",8389396}, {"BRRRT",8389395}, {"BUZZER",8389420}, {"BWEEP",8389397}, {"Background",8683655}, -{"Bishop",8683759}, -{"Bizarro",8618226}, -{"BizarroSwap",10518771}, +{"Bishop",8683761}, +{"Bizarro",8618228}, +{"BizarroSwap",10518773}, {"Broadcast",10518679}, {"BroadcastAnd",8421528}, {"BroadcastAndEx",8421529}, {"BroadcastEx",10518683}, {"BroadcastList",8421532}, @@ -544,11 +548,11 @@ {"Coloc",8487074}, {"Compatible",8487035}, {"Connect",8487075}, {"Connection",8618104}, {"Control",8421514}, -{"CopyArray",8421610}, +{"CopyArray",8421612}, {"Create",10518692}, {"DEEP_POP",8389417}, {"DEPARTED",8389125}, {"DESTROY",8389122}, {"DESTROYED",8389136}, @@ -566,11 +570,11 @@ {"Destroy",10584232}, {"Destroyed",8487033}, {"Dir",8618054}, {"Distance",9142346}, {"Done",8618103}, -{"DotProduct",8421611}, +{"DotProduct",8421613}, {"E",9437184}, {"END_TURN",8389139}, {"EditorHelp",8683665}, {"F",9437192}, {"FAROUT",8389421}, @@ -582,11 +586,11 @@ {"FlushClass",8421546}, {"FlushObj",8487083}, {"From",8421503}, {"GLASS",8389379}, {"GLISSANT",8389419}, -{"GetArray",8421605}, +{"GetArray",8421607}, {"GetInventory",8421548}, {"HAWK",8389425}, {"HEARTBEAT",8389407}, {"HIT",8389134}, {"HITBY",8389135}, @@ -598,11 +602,11 @@ {"INIT",8389120}, {"IgnoreKey",8421551}, {"Image",8618055}, {"InPlace",8683662}, {"Inertia",9142344}, -{"InitArray",8421606}, +{"InitArray",8421608}, {"Input",8683660}, {"IntMove",10584240}, {"Invisible",8618095}, {"JAYAYAYNG",8389416}, {"JUMPED",8389128}, @@ -660,28 +664,28 @@ {"ObjLayerAt",8421572}, {"ObjMovingTo",8421573}, {"ObjTopAt",8421574}, {"Order",8683657}, {"Others",8683666}, -{"P",8880364}, -{"P*",8880365}, +{"P",8880366}, +{"P*",8880367}, {"PLAYERMOVING",8389133}, {"POSTINIT",8389138}, {"POUR",8389377}, {"POWER",8389386}, {"Player",8487034}, {"PopUp",8421575}, -{"Queen",8683760}, +{"Queen",8683762}, {"Quiz",8683661}, {"R",9437198}, {"RATCHET1",8389418}, {"RATCHET2",8389412}, {"RATTLE",8389403}, {"RB",9437197}, {"RF",9437199}, {"Rel",8487113}, -{"Rook",8683758}, +{"Rook",8683760}, {"S",9437190}, {"SE",9437191}, {"SMALL_POP",8389389}, {"SPLASH",8389376}, {"STEAM",8389424}, @@ -691,21 +695,21 @@ {"SW",9437189}, {"Seek",8487114}, {"Self",8421501}, {"Send",10584267}, {"SendEx",10584268}, -{"SetArray",8421607}, +{"SetArray",8421609}, {"SetInventory",8421581}, {"Shape",8618051}, {"ShapeDir",8618074}, {"Sharp",8618073}, {"Shovable",8618075}, {"Sound",8421582}, {"Stealthy",8618100}, {"Strength",9142358}, -{"Super",8487158}, -{"SwapWorld",8421620}, +{"Super",8487160}, +{"SwapWorld",8421622}, {"Sweep",8421583}, {"SweepEx",8421584}, {"Synchronize",8421585}, {"TAHTASHH",8389409}, {"THMP_thmp",8389405}, @@ -729,16 +733,18 @@ {"WAHOO",8389400}, {"WHACK",8389423}, {"Weight",9142352}, {"WinLevel",8421591}, {"XDir",8487128}, -{"XYDir",8421593}, +{"XStep",8487129}, +{"XYDir",8421594}, {"Xloc",8486980}, -{"YDir",8487130}, +{"YDir",8487131}, {"YEEHAW",8389401}, +{"YStep",8487132}, {"Yloc",8486981}, -{"_",8421595}, +{"_",8421597}, {"a?",8421439}, {"again",8683533}, {"and",8683544}, {"band",8421415}, {"begin",8683532}, @@ -779,26 +785,26 @@ {"bor",8421416}, {"bxor",8421417}, {"c?",8421433}, {"case",8683542}, {"chain",8421536}, -{"clear",8421602}, -{"count",8421601}, -{"cut",8683761}, +{"clear",8421604}, +{"count",8421603}, +{"cut",8683763}, {"cz?",8421434}, {"dup",8421377}, {"else",8683530}, {"eq",8421424}, {"eq2",8421425}, {"exec",8486940}, -{"flip",8421600}, +{"flip",8421602}, {"for",8683537}, {"fork",8683545}, {"ge",8486965}, {"gt",8486963}, {"if",8683529}, -{"in",8421597}, +{"in",8421599}, {"is",8421431}, {"land",8421420}, {"le",8486966}, {"link",8683547}, {"lnot",8421423}, @@ -806,18 +812,18 @@ {"lsh",8421413}, {"lt",8486964}, {"lxor",8421422}, {"m?",8421435}, {"max",8486948}, -{"mbegin",8683743}, +{"mbegin",8683745}, {"min",8486947}, {"mod",8486945}, {"n?",8421432}, {"ne",8421426}, {"neg",8421410}, {"next",8683538}, -{"nin",8421598}, +{"nin",8421600}, {"nip",8421379}, {"o?",8421437}, {"or",8683543}, {"over",8421384}, {"oz?",8421438}, @@ -828,13 +834,13 @@ {"rsh",8486950}, {"rtn",8683546}, {"s?",8421436}, {"swap",8421378}, {"then",8683531}, -{"tmark",8421596}, +{"tmark",8421598}, {"tuck",8421380}, -{"uniq",8421603}, +{"uniq",8421605}, {"until",8683534}, {"while",8683535}, }; -#define N_OP_NAMES 356 +#define N_OP_NAMES 358 #endif