Index: class.doc ================================================================== --- class.doc +++ class.doc @@ -2003,10 +2003,15 @@ Ends all execution and accepts the input sequence that resulted in the current game state as a valid solution. (In other words, the goal of the game is to find a sequence of inputs that result in the execution of a WinLevel instruction, without causing any errors or executing LoseLevel.) +,WinLevel ( score -- ) + Same as WinLevel but you can set the score, which is treated as a signed + number; lower numbers are considered to be a better score. (Currently, + the score is not used by anything.) + XDir ( dir -- newx ) Finds the X coordinate of the cell in the specified direction. ,XDir ( obj dir -- newx ) Finds the X coordinate of the cell in the specified direction of the Index: exec.c ================================================================== --- exec.c +++ exec.c @@ -41,10 +41,11 @@ Uint16 ndeadanim; DeadAnimation*deadanim; Uint8 no_dead_anim; Uint32 max_trigger; Uint8 conn_option; +Sint32 gameover_score; typedef struct { Uint16 msg; Uint32 from; Value arg1,arg2,arg3; @@ -3189,11 +3190,12 @@ case OP_WEIGHT_C: StackReq(1,1); Push(GetVariableOrAttributeOf(weight,NVALUE)); break; case OP_WEIGHT_E: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->weight=t1.u; break; case OP_WEIGHT_E16: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->weight=t1.u&0xFFFF; break; case OP_WEIGHT_EC: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i!=VOIDLINK) objects[i]->weight=t1.u; break; case OP_WEIGHT_EC16: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i!=VOIDLINK) objects[i]->weight=t1.u&0xFFFF; break; - case OP_WINLEVEL: key_ignored=0; gameover=1; Throw(0); break; + case OP_WINLEVEL: key_ignored=0; gameover=1; gameover_score=move_number+1; Throw(0); break; + case OP_WINLEVEL_C: StackReq(1,0); t1=Pop(); Numeric(t1); key_ignored=0; gameover=1; gameover_score=t1.s; 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; Index: heromesh.h ================================================================== --- heromesh.h +++ heromesh.h @@ -303,10 +303,11 @@ extern Uint16 ndeadanim; extern DeadAnimation*deadanim; extern Uint8 no_dead_anim; extern Uint32 max_trigger; extern Uint8 conn_option; +extern Sint32 gameover_score; const unsigned char*value_string_ptr(Value v); void pfunlink(Uint32 n); void pflink(Uint32 n); Uint32 objalloc(Uint16 c); Index: instruc ================================================================== --- instruc +++ instruc @@ -287,11 +287,11 @@ Trace ,TraceStack Trigger TriggerAt VolumeAt -WinLevel +,WinLevel ,XDir ,XStep XYDir ,YDir ,YStep Index: instruc.h ================================================================== --- instruc.h +++ instruc.h @@ -429,10 +429,11 @@ #define OP_TRACESTACK_C 35030 #define OP_TRIGGER 32983 #define OP_TRIGGERAT 32984 #define OP_VOLUMEAT 32985 #define OP_WINLEVEL 32986 +#define OP_WINLEVEL_C 35034 #define OP_XDIR 32987 #define OP_XDIR_C 35035 #define OP_XSTEP 32988 #define OP_XSTEP_C 35036 #define OP_XYDIR 32989 @@ -741,11 +742,11 @@ {"VolumeAt",8421593}, {"W",9437188}, {"WAHOO",8389400}, {"WHACK",8389423}, {"Weight",9142352}, -{"WinLevel",8421594}, +{"WinLevel",8487130}, {"XDir",8487131}, {"XStep",8487132}, {"XYDir",8421597}, {"Xloc",8486980}, {"YDir",8487134},