Index: class.c ================================================================== --- class.c +++ class.c @@ -1103,12 +1103,13 @@ if(Tokenf(TF_MACRO)) ParseError("Unexpected macro\n"); if(Tokenf(TF_DIR)) { cl->codes[ptr++]=tokenv&15; } else if(Tokenf(TF_NAME)) { switch(tokenv) { - case OP_ADD: case OP_CLIMB: case OP_EIGHT: case OP_FOUR: - case OP_HEIGHT: case OP_LOC: case OP_MARK: case OP_SUB: + case OP_ADD: case OP_CLIMB: case OP_HEIGHT: + case OP_LOC: case OP_MARK: case OP_SUB: + case OP_QUEEN: case OP_ROOK: case OP_BISHOP: case OP_DIR: case OP_DIR_C: case OP_DIR_E: case OP_DIR_EC: case OP_OBJTOPAT: case OP_OBJBOTTOMAT: case OP_CUT: case OP_MUL: case OP_OBJABOVE: case OP_OBJBELOW: case OP_TRACE: case OP_NEXT: case 0x0200 ... 0x02FF: // message case 0x4000 ... 0x7FFF: // class Index: class.doc ================================================================== --- class.doc +++ class.doc @@ -2311,10 +2311,13 @@ or more times. The match is greedy; it will match as much as possible. begin Begin a block. +Bishop + Try four directions (NE, NW, SW, and SE). + Climb Fail the match if the origin object cannot climb here. (Climb ) Fail the match if the height here is greater than this number. @@ -2323,16 +2326,10 @@ Discards the most recent choice point. else Delimits alternatives within a block. -Four - Try four directions (E, N, W, and S). - -Eight - Try all eight directions. - Height Fail the match if the origin object can climb here. (Height ) Fail the match if the height here isn't greater than this number. @@ -2353,10 +2350,16 @@ Match the object at the bottom of this location. ObjTopAt Match the object at the top of this location. +Queen + Try all eight directions. + +Rook + Try four directions (E, N, W, and S). + then Ends a block started with begin or if. Trace Used for debugging. Index: exec.c ================================================================== --- exec.c +++ exec.c @@ -1722,10 +1722,23 @@ ptr=code[ptr]+2; break; case OP_BEGIN: ptr++; break; + case OP_BISHOP: + if(cpi>=MAXCHOICE-4) Throw("Choice overflow"); + d=1; + cpi+=3; + cp[cpi].x=x; + cp[cpi].y=y; + cp[cpi].depth=vstackptr; + cp[cpi].ptr=ptr; + cp[cpi-1]=cp[cpi-2]=cp[cpi]; + cp[cpi].dir=3; + cp[cpi-1].dir=5; + cp[cpi-2].dir=7; + break; case OP_CLIMB: if(playfield[x+y*64-65]==VOIDLINK || height_at(x,y)>objects[obj]->climb) goto fail; break; case OP_CLIMB_C: g=code[ptr++]; @@ -1748,44 +1761,14 @@ case OP_DIR_EC: if(n==VOIDLINK) Throw("No object specified in pattern"); changed=1; objects[n]->dir=d; break; - case OP_EIGHT: - if(cpi>=MAXCHOICE-8) Throw("Choice overflow"); - d=0; - cpi+=7; - cp[cpi].x=x; - cp[cpi].y=y; - cp[cpi].depth=vstackptr; - cp[cpi].ptr=ptr; - cp[cpi-1]=cp[cpi-2]=cp[cpi-3]=cp[cpi-4]=cp[cpi-5]=cp[cpi-6]=cp[cpi]; - cp[cpi].dir=1; - cp[cpi-1].dir=2; - cp[cpi-2].dir=3; - cp[cpi-3].dir=4; - cp[cpi-4].dir=5; - cp[cpi-5].dir=6; - cp[cpi-6].dir=7; - break; case OP_ELSE: ptr--; while(code[ptr]==OP_ELSE) ptr=code[ptr+2]; break; - case OP_FOUR: - if(cpi>=MAXCHOICE-4) Throw("Choice overflow"); - d=0; - cpi+=3; - cp[cpi].x=x; - cp[cpi].y=y; - cp[cpi].depth=vstackptr; - cp[cpi].ptr=ptr; - cp[cpi-1]=cp[cpi-2]=cp[cpi]; - cp[cpi].dir=2; - cp[cpi-1].dir=4; - cp[cpi-2].dir=6; - break; case OP_HEIGHT: if(playfield[x+y*64-65]==VOIDLINK || height_at(x,y)<=objects[obj]->climb) goto fail; break; case OP_HEIGHT_C: g=code[ptr++]; @@ -1828,10 +1811,27 @@ n=obj_bottom_at(x,y); break; case OP_OBJTOPAT: n=obj_top_at(x,y); break; + case OP_QUEEN: + if(cpi>=MAXCHOICE-8) Throw("Choice overflow"); + d=0; + cpi+=7; + cp[cpi].x=x; + cp[cpi].y=y; + cp[cpi].depth=vstackptr; + cp[cpi].ptr=ptr; + cp[cpi-1]=cp[cpi-2]=cp[cpi-3]=cp[cpi-4]=cp[cpi-5]=cp[cpi-6]=cp[cpi]; + cp[cpi].dir=1; + cp[cpi-1].dir=2; + cp[cpi-2].dir=3; + cp[cpi-3].dir=4; + cp[cpi-4].dir=5; + cp[cpi-5].dir=6; + cp[cpi-6].dir=7; + break; case OP_RET: if(all) { if(vstackptr>=VSTACKSIZE-1) Throw("Stack overflow"); if(n==VOIDLINK) n=obj_bottom_at(x,y); Push(OVALUE(n)); @@ -1838,10 +1838,23 @@ goto fail; } else { return n==VOIDLINK?obj_bottom_at(x,y):n; } break; + case OP_ROOK: + if(cpi>=MAXCHOICE-4) Throw("Choice overflow"); + d=0; + cpi+=3; + cp[cpi].x=x; + cp[cpi].y=y; + cp[cpi].depth=vstackptr; + cp[cpi].ptr=ptr; + cp[cpi-1]=cp[cpi-2]=cp[cpi]; + cp[cpi].dir=2; + cp[cpi-1].dir=4; + cp[cpi-2].dir=6; + break; case OP_SUB: if(vstackptr>=VSTACKSIZE-1) Throw("Stack overflow"); Push(NVALUE(0)); break; case OP_THEN: Index: instruc ================================================================== --- instruc +++ instruc @@ -295,12 +295,13 @@ DotProduct ; Pattern matching -,=Pattern "P" -,=PatternS "P*" --Four --Eight +-Rook +-Bishop +-Queen -cut ; Inheritance -Abstract ,Super Index: instruc.h ================================================================== --- instruc.h +++ instruc.h @@ -427,24 +427,25 @@ #define OP_PATTERN_EC 39132 #define OP_PATTERNS 32989 #define OP_PATTERNS_C 35037 #define OP_PATTERNS_E 37085 #define OP_PATTERNS_EC 39133 -#define OP_FOUR 32990 -#define OP_EIGHT 32991 -#define OP_CUT 32992 -#define OP_ABSTRACT 32993 -#define OP_SUPER 32994 -#define OP_SUPER_C 35042 -#define OP_FUNCTION 32995 -#define OP_LOCAL 32996 -#define OP_LABEL 32997 -#define OP_STRING 32998 -#define OP_INT16 32999 -#define OP_INT32 33000 -#define OP_DISPATCH 33001 -#define OP_USERFLAG 33002 +#define OP_ROOK 32990 +#define OP_BISHOP 32991 +#define OP_QUEEN 32992 +#define OP_CUT 32993 +#define OP_ABSTRACT 32994 +#define OP_SUPER 32995 +#define OP_SUPER_C 35043 +#define OP_FUNCTION 32996 +#define OP_LOCAL 32997 +#define OP_LABEL 32998 +#define OP_STRING 32999 +#define OP_INT16 33000 +#define OP_INT32 33001 +#define OP_DISPATCH 33002 +#define OP_USERFLAG 33003 #ifdef HEROMESH_CLASS static const Op_Names op_names[]={ {"*",8486939}, {"+",8421401}, {"+Move",10584238}, @@ -453,11 +454,11 @@ {"-rot",8421382}, {".",10518528}, {"/",8486940}, {"ANHH",8389394}, {"ARRIVED",8389124}, -{"Abstract",8683745}, +{"Abstract",8683746}, {"Animate",8421516}, {"AnimateDead",8421517}, {"Arg1",8552571}, {"Arg2",8552572}, {"Arg3",8552573}, @@ -478,10 +479,11 @@ {"BRRREEET",8389396}, {"BRRRT",8389395}, {"BUZZER",8389420}, {"BWEEP",8389397}, {"Background",8683650}, +{"Bishop",8683743}, {"Broadcast",10518671}, {"BroadcastAnd",8421520}, {"BroadcastAndEx",8421521}, {"BroadcastEx",10518675}, {"BroadcastList",8421524}, @@ -528,20 +530,18 @@ {"Done",8618099}, {"DotProduct",8421595}, {"E",9437184}, {"END_TURN",8389139}, {"EditorHelp",8683657}, -{"Eight",8683743}, {"F",9437192}, {"FAROUT",8389421}, {"FFFFTT",8389399}, {"FLOATED",8389132}, {"FROG",8389383}, {"Finished",8552577}, {"FlushClass",8421535}, {"FlushObj",8487072}, -{"Four",8683742}, {"From",8421498}, {"GLASS",8389379}, {"GLISSANT",8389419}, {"GetArray",8421589}, {"GetInventory",8421537}, @@ -624,18 +624,20 @@ {"POSTINIT",8389138}, {"POUR",8389377}, {"POWER",8389386}, {"Player",8487029}, {"PopUp",8421563}, +{"Queen",8683744}, {"Quiz",8683653}, {"R",9437198}, {"RATCHET1",8389418}, {"RATCHET2",8389412}, {"RATTLE",8389403}, {"RB",9437197}, {"RF",9437199}, {"Rel",8487101}, +{"Rook",8683742}, {"S",9437190}, {"SE",9437191}, {"SMALL_POP",8389389}, {"SPLASH",8389376}, {"STEAM",8389424}, @@ -654,11 +656,11 @@ {"Sharp",8618069}, {"Shovable",8618071}, {"Sound",8421570}, {"Stealthy",8618096}, {"Strength",9142354}, -{"Super",8487138}, +{"Super",8487139}, {"Synchronize",8421571}, {"TAHTASHH",8389409}, {"THMP_thmp",8389405}, {"THWIT",8389384}, {"TICK",8389391}, @@ -730,11 +732,11 @@ {"c?",8421429}, {"case",8683542}, {"chain",8421528}, {"clear",8421586}, {"count",8421585}, -{"cut",8683744}, +{"cut",8683745}, {"cz?",8421430}, {"dup",8421377}, {"else",8683530}, {"eq",8421420}, {"eq2",8421421}, @@ -779,7 +781,7 @@ {"tuck",8421380}, {"uniq",8421587}, {"until",8683534}, {"while",8683535}, }; -#define N_OP_NAMES 335 +#define N_OP_NAMES 336 #endif