Index: bindings.c ================================================================== --- bindings.c +++ bindings.c @@ -201,11 +201,11 @@ } } } while((i=sqlite3_step(cmd->stmt))==SQLITE_ROW) { if(i=sqlite3_data_count(cmd->stmt)) { - j=i>1?sqlite3_column_int(cmd->stmt,1):0; + j=(i>1&&sqlite3_column_type(cmd->stmt,1)!=SQLITE_NULL)?sqlite3_column_int(cmd->stmt,1):y*64+x; if((name=sqlite3_column_text(cmd->stmt,0)) && *name) { k=name[0]*'\1\0'+name[1]*'\0\1'; while(i && sqlite3_column_type(cmd->stmt,i-1)==SQLITE_NULL) i--; prev=cb(prev,k,j,i,cmd->stmt,aux); if(prev<0) { Index: edit.c ================================================================== --- edit.c +++ edit.c @@ -54,15 +54,18 @@ draw_text(16,16,buf,0xF0,0xFF); snprintf(buf,32,"%5d",level_code); draw_text(0,24,"C",0xF0,0xF7); draw_text(16,24,buf,0xF0,0xFF); } + snprintf(buf,8,"%2dx%2d",pfwidth,pfheight); + draw_text(8,32,buf,0xF0,0xFD); + draw_text(24,32,"x",0xF0,0xF5); x=x>=left_margin?(x-left_margin)/picture_size+1:0; y=y/picture_size+1; if(x>0 && y>0 && x<=pfwidth && y<=pfheight) snprintf(buf,8,"(%2d,%2d)",x,y); else strcpy(buf," "); - draw_text(0,32,buf,0xF0,0xF3); + draw_text(0,40,buf,0xF0,0xF3); SDL_UnlockSurface(screen); SDL_Flip(screen); } static void show_mouse_xy(SDL_Event*ev) { @@ -72,11 +75,11 @@ y=ev->motion.y/picture_size+1; if(ev->motion.x0 && y>0 && x<=pfwidth && y<=pfheight) snprintf(buf,8,"(%2d,%2d)",x,y); else strcpy(buf," "); SDL_LockSurface(screen); - draw_text(0,32,buf,0xF0,0xF3); + draw_text(0,40,buf,0xF0,0xF3); SDL_UnlockSurface(screen); SDL_Flip(screen); } static void set_caption(void) { @@ -127,10 +130,11 @@ set_cursor(ev.motion.x=0?read_lump(FIL_LEVEL,lvl,&sz,0):0; unsigned char*p=buf; unsigned char*end=buf+sz; int i,n,x,y,z; + Uint16 lo=0; Uint32 o; Uint32 mru[2]; + if(lvl<0 && level_index && -lvl<=level_nindex) { + lo=-lvl; + lvl=level_index[~lvl]; + } if(lvl<0) return "Invalid level ID"; if(!buf) return "Cannot find level"; free(level_title); level_title=0; annihilate(); @@ -308,12 +313,12 @@ } // skip level strings for now if(p>end) goto bad1; free(buf); level_id=lvl; - level_ord=0; - if(level_index) { + level_ord=lo; + if(level_index && !lo) { for(i=0;i