Index: TODO ================================================================== --- TODO +++ TODO @@ -4,11 +4,12 @@ * Game engine features * String data (partially implemented) * A ,PopUp command to use a popup with arguments starting from a mark * Returning a class from COLLIDE/COLLIDEBY to transform * Possibility to define auto-generation levels mode - * Popup inventory list (with optional possibility of choice) + * Popup inventory list (with optional possibility of choice) (?) + * Playfield array * Editor * Mouse dragging * Deal better with allowing to skip past corrupted levels * Picture editor/loading * Allowing more altimages Index: comconfig.doc ================================================================== --- comconfig.doc +++ comconfig.doc @@ -119,10 +119,14 @@ CONFIG_USERCACHE_PERMISSIONS If defined as a octal number, set the default file permissions of the user cache database when creating it. (The user can still change them afterward by using chmod.) + +CONFIG_USING_32BIT_COORDINATES + If defined, allow 32-bit coordinates in SDL_Rect and in other graphics + functions of SDL. CONFIG_USING_APPIMAGE If defined, it will check the environment variables having to do with AppImage and will be able to load the default resources from there, as well as allow the configuration file to reference the AppImage directory. Index: picture.c ================================================================== --- picture.c +++ picture.c @@ -19,10 +19,14 @@ #include "quarks.h" #include "heromesh.h" #include "cursorshapes.h" #include "keyicons.xbm" +#define PPR 128 // pictures per row +#define PPRM 127 // pictures per row bit mask (one less than pictures per row) +#define PPRS 7 // pictures per row bit shift amount (log2 of pictures per row) + SDL_Surface*screen; Uint16 picture_size; int left_margin; Uint32 codepage; @@ -88,11 +92,11 @@ SDL_SetColors(picts,pal,0,256); } void draw_picture(int x,int y,Uint16 img) { // To be called only when screen is unlocked! - SDL_Rect src={(img&15)*picture_size,(img>>4)*picture_size,picture_size,picture_size}; + SDL_Rect src={(img&PPRM)*picture_size,(img>>PPRS)*picture_size,picture_size,picture_size}; SDL_Rect dst={x,y,picture_size,picture_size}; SDL_BlitSurface(picts,&src,screen,&dst); } void draw_cell(int x,int y) { @@ -451,11 +455,11 @@ while(which--) load_one_picture_sub(fp,size=buf[i],meth=(i==1?*buf>>4:buf[(*buf&15)+1+((i-2)>>1)]>>(i&1?4:0))&15),i++; if(meth==5 || meth==6) meth^=3; if(meth==15) meth=0; SDL_LockSurface(picts); pitch=picts->pitch; - pix=picts->pixels+((img&15)+pitch*(img>>4))*picture_size; + pix=picts->pixels+((img&PPRM)+pitch*(img>>PPRS))*picture_size; for(i=0;i>4)*picture_size,picture_size,picture_size}; + SDL_Rect dst={(img&PPRM)*picture_size,(img>>PPRS)*picture_size,picture_size,picture_size}; sqlite3_stmt*st; int c,i,x,y; char nam[128]; Uint8 buf[512]; Uint8*p; @@ -563,12 +567,12 @@ } else if(i!=SQLITE_ROW) { fatal("SQL error (%d): %s\n",i,sqlite3_errmsg(userdb)); } i=sqlite3_column_int(st,0); sqlite3_reset(st); - src.x=(i&15)*picture_size; - src.y=(i>>4)*picture_size; + src.x=(i&PPRM)*picture_size; + src.y=(i>>PPRS)*picture_size; SDL_SetColorKey(picts,0,0); SDL_BlitSurface(picts,&src,picts,&dst); } else { SDL_FillRect(picts,&dst,0); } @@ -579,11 +583,11 @@ case 8: // *->* *->* *->* c=fgetc(fp); sz-=c+1; fread(buf,1,c&255,fp); SDL_LockSurface(picts); - p=picts->pixels+((img&15)+picts->pitch*(img>>4))*picture_size; + p=picts->pixels+((img&PPRM)+picts->pitch*(img>>PPRS))*picture_size; for(y=0;y*->*->*->* c=fgetc(fp); sz-=c+1; fread(buf,1,c&255,fp); SDL_LockSurface(picts); - p=picts->pixels+((img&15)+picts->pitch*(img>>4))*picture_size; + p=picts->pixels+((img&PPRM)+picts->pitch*(img>>PPRS))*picture_size; for(y=0;y* *<->* *<->* c=fgetc(fp); sz-=c+1; fread(buf,1,c&255,fp); SDL_LockSurface(picts); - p=picts->pixels+((img&15)+picts->pitch*(img>>4))*picture_size; + p=picts->pixels+((img&PPRM)+picts->pitch*(img>>PPRS))*picture_size; for(y=0;y>4)*picture_size; + src.x=(i&PPRM)*picture_size; + src.y=(i>>PPRS)*picture_size; SDL_BlitSurface(picts,&src,picts,&dst); break; case 12 ... 15: // Shift (up/down/right/left) while(sz>0) { x=fgetc(fp); @@ -683,11 +687,11 @@ case 16: // Hue/shade fread(buf,1,2,fp); c=(Sint8)buf[1]; sz-=2; SDL_LockSurface(picts); - p=picts->pixels+((img&15)+picts->pitch*(img>>4))*picture_size; + p=picts->pixels+((img&PPRM)+picts->pitch*(img>>PPRS))*picture_size; for(y=0;y>4),8,0,0,0,0); + picts=SDL_CreateRGBSurface((i?SDL_HWSURFACE:SDL_SWSURFACE)|SDL_SRCCOLORKEY,picture_size<>PPRS),8,0,0,0,0); if(!picts) fatal("Error allocating surface for pictures: %s\n",SDL_GetError()); init_palette(); for(i=0;i