Index: bindings.doc ================================================================== --- bindings.doc +++ bindings.doc @@ -82,10 +82,14 @@ Display the pop-up help text of the object at the location. '^g' Display values of global variables. +'^n' + List objects at the specified coordinates in the bizarro world, to + examine their values. + '^o' List objects at the specified coordinates, to examine their values. '^p' Start or stop slow replay. Any move input also interrupts slow replay. Index: default.heromeshrc ================================================================== --- default.heromeshrc +++ default.heromeshrc @@ -108,10 +108,11 @@ ?.gameKey.ctrl.D: select '^d',$key_xy; ?.gameKey.ctrl.E: ^E ?.gameKey.ctrl.I: select 'mi',:import_move_list; ?.gameKey.ctrl.X: select 'mx',:export_move_list; ?.gameClick.right: ^o +?.gameClick.shift.right: ^n ?.gameClick.middle: ^d ?.gameKey.kp_enter: =0 ?.gameKey.escape: =0 ?.gameKey.f1: +1 ?.gameKey.f2: +10 Index: exec.c ================================================================== --- exec.c +++ exec.c @@ -25,10 +25,11 @@ Uint32 nobjects; Value globals[0x800]; Uint32 firstobj=VOIDLINK; Uint32 lastobj=VOIDLINK; Uint32 playfield[64*64]; // bottom-most object per cell +Uint32 bizplayfield[64*64]; // bizarro world Uint8 pfwidth,pfheight; Sint8 gameover,key_ignored; Uint8 generation_number_inc; Uint32 move_number; unsigned char*quiz_text; @@ -2584,11 +2585,11 @@ return t; } void annihilate(void) { Uint32 i; - for(i=0;i<64*64;i++) playfield[i]=VOIDLINK; + for(i=0;i<64*64;i++) playfield[i]=bizplayfield[i]=VOIDLINK; firstobj=lastobj=VOIDLINK; if(quiz_text) { sqlite3_free(quiz_text); quiz_text=0; } Index: function.c ================================================================== --- function.c +++ function.c @@ -15,10 +15,12 @@ struct sqlite3_vtab_cursor; sqlite3_int64 rowid; char unique,eof; Uint16 arg[4]; } Cursor; + +static void*bizarro_vtab; static void find_first_usable_image(const Class*cl,sqlite3_context*cxt) { int i; if(cl->cflags&CF_GROUP) return; if(!cl->images) return; @@ -362,10 +364,11 @@ } static int vt0_connect(sqlite3*db,void*aux,int argc,const char*const*argv,sqlite3_vtab**vt,char**err) { sqlite3_declare_vtab(db,aux); *vt=sqlite3_malloc(sizeof(sqlite3_vtab)); + if(*vt && argv[0][0]=='B') bizarro_vtab=*vt; return *vt?SQLITE_OK:SQLITE_NOMEM; } static int vt0_disconnect(sqlite3_vtab*vt) { sqlite3_free(vt); @@ -633,10 +636,13 @@ if(objects[cur->rowid]->down!=VOIDLINK) sqlite3_result_int64(cxt,objects[cur->rowid]->down); break; case 11: // DENSITY sqlite3_result_int(cxt,objects[cur->rowid]->density); break; + case 12: // BIZARRO + sqlite3_result_int(cxt,objects[cur->rowid]->oflags&OF_BIZARRO?1:0); + break; } return SQLITE_OK; } static int vt1_objects_next(sqlite3_vtab_cursor*pcur) { @@ -661,11 +667,11 @@ cur->arg[1]=1; } else if((cur->arg[0]&0x0066) && !cur->arg[1]) { // Find top/bottom at location cur->arg[1]=1; atxy: - cur->rowid=playfield[cur->arg[2]+cur->arg[3]*64-65]; + cur->rowid=(cur->pVtab==bizarro_vtab?bizplayfield:playfield)[cur->arg[2]+cur->arg[3]*64-65]; if(cur->rowid==VOIDLINK) goto nextxy; if(cur->arg[0]&0x0020) { while(cur->rowid!=VOIDLINK && objects[cur->rowid]->up!=VOIDLINK) cur->rowid=objects[cur->rowid]->up; } } else if(cur->arg[0]&0x0020) { @@ -700,11 +706,14 @@ } } else { // This shouldn't happen return SQLITE_INTERNAL; } - if(!cur->eof && !objects[cur->rowid]->generation) goto again; + if(!cur->eof) { + if(!objects[cur->rowid]->generation) goto again; + if((objects[cur->rowid]->oflags&OF_BIZARRO)!=(cur->pVtab==bizarro_vtab?OF_BIZARRO:0)) goto again; + } return SQLITE_OK; } static int vt1_objects_filter(sqlite3_vtab_cursor*pcur,int idxNum,const char*idxStr,int argc,sqlite3_value**argv) { Cursor*cur=(void*)pcur; @@ -920,10 +929,11 @@ z=sqlite3_value_int(argv[3]); if(z<=0 || z>=0x4000 || !classes[z]) return SQLITE_CONSTRAINT_FOREIGNKEY; if(sqlite3_value_int(argv[7])<0 || sqlite3_value_int(argv[7])>=classes[z]->nimages) return SQLITE_CONSTRAINT_CHECK; id=objalloc(z); if(id==VOIDLINK) return SQLITE_CONSTRAINT_VTAB; + if(vt==bizarro_vtab) objects[id]->oflags|=OF_BIZARRO; else objects[id]->oflags&=~OF_BIZARRO; goto update; } else { // UPDATE id=sqlite3_value_int64(argv[0]); if(id!=sqlite3_value_int64(argv[1]) || id!=sqlite3_value_int64(argv[2])) return SQLITE_CONSTRAINT_VTAB; @@ -996,11 +1006,14 @@ sqlite3_create_function(userdb,"SOLUTION_CACHEID",0,SQLITE_UTF8|SQLITE_DETERMINISTIC,ptr1,fn_cacheid,0,0); sqlite3_create_function(userdb,"TRACE_OFF",0,SQLITE_UTF8,"",fn_trace_on,0,0); sqlite3_create_function(userdb,"TRACE_ON",0,SQLITE_UTF8,"\x01",fn_trace_on,0,0); sqlite3_create_function(userdb,"XY",2,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_xy,0,0); sqlite3_create_function(userdb,"ZERO_EXTEND",1,SQLITE_UTF8|SQLITE_DETERMINISTIC,0,fn_zero_extend,0,0); + bizarro_vtab=""; // ensure that it is not null sqlite3_create_module(userdb,"CLASSES",&vt_classes,"CREATE TABLE `CLASSES`(`ID` INTEGER PRIMARY KEY, `NAME` TEXT, `EDITORHELP` TEXT, `HELP` TEXT," "`INPUT` INT, `QUIZ` INT, `TRACEIN` INT, `TRACEOUT` INT, `GROUP` TEXT, `PLAYER` INT);"); sqlite3_create_module(userdb,"MESSAGES",&vt_messages,"CREATE TABLE `MESSAGES`(`ID` INTEGER PRIMARY KEY, `NAME` TEXT, `TRACE` INT);"); sqlite3_create_module(userdb,"OBJECTS",&vt_objects,"CREATE TABLE `OBJECTS`(`ID` INTEGER PRIMARY KEY, `CLASS` INT, `MISC1` INT, `MISC2` INT, `MISC3` INT," - "`IMAGE` INT, `DIR` INT, `X` INT, `Y` INT, `UP` INT, `DOWN` INT, `DENSITY` INT HIDDEN);"); + "`IMAGE` INT, `DIR` INT, `X` INT, `Y` INT, `UP` INT, `DOWN` INT, `DENSITY` INT HIDDEN, `BIZARRO` INT HIDDEN);"); + sqlite3_create_module(userdb,"BIZARRO_OBJECTS",&vt_objects,"CREATE TABLE `OBJECTS`(`ID` INTEGER PRIMARY KEY, `CLASS` INT, `MISC1` INT, `MISC2` INT, `MISC3` INT," + "`IMAGE` INT, `DIR` INT, `X` INT, `Y` INT, `UP` INT, `DOWN` INT, `DENSITY` INT HIDDEN, `BIZARRO` INT HIDDEN);"); } Index: game.c ================================================================== --- game.c +++ game.c @@ -547,11 +547,11 @@ exit(0); break; } } -static void list_objects_at(int xy) { +static void list_objects_at(int xy,Uint32*pf,const char*s) { static const char*const dirs[8]={"E ","NE","N ","NW","W ","SW","S ","SE"}; SDL_Event ev; SDL_Rect r; char buf[256]; int scroll=0; @@ -558,11 +558,11 @@ int count=0; Uint32 n,t; Object*o; int i,j; if(xy<0 || xy>=64*64) return; - n=playfield[xy]; + n=pf[xy]; if(n==VOIDLINK) return; while(n!=VOIDLINK) t=n,count++,n=objects[n]->up; redraw: r.x=r.y=0; r.w=screen->w; @@ -569,11 +569,11 @@ r.h=screen->h; SDL_FillRect(screen,&r,0xF1); r.y=8; r.h-=8; scrollbar(&scroll,r.h/8,count,0,&r); - snprintf(buf,255," %d objects at (%d,%d): ",count,(xy&63)+1,(xy/64)+1); + snprintf(buf,255," %d %sobjects at (%d,%d): ",count,s,(xy&63)+1,(xy/64)+1); SDL_LockSurface(screen); draw_text(0,0,buf,0xF7,0xF0); n=t; for(i=0;idown; for(i=0;ih/8 && n!=VOIDLINK;i++) { @@ -749,12 +749,15 @@ describe_at(number-65); return prev; case '^g': // Display global variables global_examine(); return prev; + case '^n': // List objects (bizarro) + list_objects_at(number-65,bizplayfield,"bizarro "); + return prev; case '^o': // List objects - list_objects_at(number-65); + list_objects_at(number-65,playfield,""); return prev; case '^p': // Slow replay replay_time=replay_time?0:1; return 0; case '^s': // Toggle solution replay Index: heromesh.h ================================================================== --- heromesh.h +++ heromesh.h @@ -252,10 +252,11 @@ extern Object**objects; extern Uint32 nobjects; extern Value globals[0x800]; extern Uint32 firstobj,lastobj; extern Uint32 playfield[64*64]; +extern Uint32 bizplayfield[64*64]; extern Uint8 pfwidth,pfheight; extern Sint8 gameover,key_ignored; extern Uint8 generation_number_inc; extern Uint32 move_number; extern unsigned char*quiz_text; Index: instruc ================================================================== --- instruc +++ instruc @@ -302,10 +302,17 @@ -,=PatternS "P*" -Rook -Bishop -Queen -cut + +; Bizarro world +,=Bizarro +.,BizarroSwap +SwapWorld +BizarroTopAt +BizarroBottomAt ; Inheritance -Abstract ,Super Index: instruc.h ================================================================== --- instruc.h +++ instruc.h @@ -434,21 +434,32 @@ #define OP_PATTERNS_EC 39136 #define OP_ROOK 32993 #define OP_BISHOP 32994 #define OP_QUEEN 32995 #define OP_CUT 32996 -#define OP_ABSTRACT 32997 -#define OP_SUPER 32998 -#define OP_SUPER_C 35046 -#define OP_FUNCTION 32999 -#define OP_LOCAL 33000 -#define OP_LABEL 33001 -#define OP_STRING 33002 -#define OP_INT16 33003 -#define OP_INT32 33004 -#define OP_DISPATCH 33005 -#define OP_USERFLAG 33006 +#define OP_BIZARRO 32997 +#define OP_BIZARRO_C 35045 +#define OP_BIZARRO_E 37093 +#define OP_BIZARRO_EC 39141 +#define OP_BIZARROSWAP 32998 +#define OP_BIZARROSWAP_C 35046 +#define OP_BIZARROSWAP_D 41190 +#define OP_BIZARROSWAP_CD 43238 +#define OP_SWAPWORLD 32999 +#define OP_BIZARROTOPAT 33000 +#define OP_BIZARROBOTTOMAT 33001 +#define OP_ABSTRACT 33002 +#define OP_SUPER 33003 +#define OP_SUPER_C 35051 +#define OP_FUNCTION 33004 +#define OP_LOCAL 33005 +#define OP_LABEL 33006 +#define OP_STRING 33007 +#define OP_INT16 33008 +#define OP_INT32 33009 +#define OP_DISPATCH 33010 +#define OP_USERFLAG 33011 #ifdef HEROMESH_CLASS static const Op_Names op_names[]={ {"*",8486939}, {"+",8421401}, {"+Move",10584239}, @@ -457,11 +468,11 @@ {"-rot",8421382}, {".",10518528}, {"/",8486940}, {"ANHH",8389394}, {"ARRIVED",8389124}, -{"Abstract",8683749}, +{"Abstract",8683754}, {"Animate",8421516}, {"AnimateDead",8421517}, {"Arg1",8552571}, {"Arg2",8552572}, {"Arg3",8552573}, @@ -483,10 +494,14 @@ {"BRRRT",8389395}, {"BUZZER",8389420}, {"BWEEP",8389397}, {"Background",8683650}, {"Bishop",8683746}, +{"Bizarro",8618213}, +{"BizarroBottomAt",8421609}, +{"BizarroSwap",10584294}, +{"BizarroTopAt",8421608}, {"Broadcast",10518671}, {"BroadcastAnd",8421520}, {"BroadcastAndEx",8421521}, {"BroadcastEx",10518675}, {"BroadcastList",8421524}, @@ -660,11 +675,12 @@ {"Sharp",8618069}, {"Shovable",8618071}, {"Sound",8421571}, {"Stealthy",8618096}, {"Strength",9142354}, -{"Super",8487142}, +{"Super",8487147}, +{"SwapWorld",8421607}, {"Synchronize",8421572}, {"TAHTASHH",8389409}, {"THMP_thmp",8389405}, {"THWIT",8389384}, {"TICK",8389391}, @@ -787,7 +803,7 @@ {"tuck",8421380}, {"uniq",8421590}, {"until",8683534}, {"while",8683535}, }; -#define N_OP_NAMES 339 +#define N_OP_NAMES 344 #endif