Overview
Comment: | Implement editing multidependent pictures; also improve comconfig.doc (independently) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
3083ae9c8d8f4d15f8e56d57765464f6 |
User & Date: | user on 2022-07-21 21:15:32 |
Other Links: | manifest | tags |
Context
2022-07-21
| ||
23:39 | Finish the implementation of multidependent pictures. check-in: 59c1955556 user: user tags: trunk | |
21:15 | Implement editing multidependent pictures; also improve comconfig.doc (independently) check-in: 3083ae9c8d user: user tags: trunk | |
2022-07-20
| ||
05:10 | Start to implement multidependent picture lumps (currently only adding/deleting them in the picture editor and listing them; you cannot edit nor use them yet). check-in: ed54db3698 user: user tags: trunk | |
Changes
Modified comconfig.doc from [44f21afded] to [e827074f10].
︙ | ︙ | |||
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | in future when they are implemented. CONFIG_ERROR_CHECKING Define error checking level, where 9 is maximum. Lower numbers might improve speed but may make the program crash in some cases and may also cause security vulnerabilities. CONFIG_MULTIUSER_SCORES (Meant for storing scores on a multiuser system, somehow) CONFIG_PRIVATE_USERCACHE 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_RANDOM_SOURCE Device to read random numbers from instead of using the random number | > > > > > > > > > > > > > > > > | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | in future when they are implemented. CONFIG_ERROR_CHECKING Define error checking level, where 9 is maximum. Lower numbers might improve speed but may make the program crash in some cases and may also cause security vulnerabilities. CONFIG_LAUNCHER_PATH If defined, then it is the full path to a file to execute if Free Hero Mesh has been invoked with no command-line arguments, or if it is given the flag to run the launcher program instead. CONFIG_MULTIUSER_SCORES (Meant for storing scores on a multiuser system, somehow) CONFIG_OMIT_EDITOR If defined, omit the level editor and picture editor. CONFIG_OMIT_MUSIC If defined, omit background music playback capabilities. (Even if this is not defined, it can still be disabled at runtime. CONFIG_OMIT_SOUND If defined, omit all sound capabilities (including music). (Even if it is not defined, it can still be disabled at runtime.) CONFIG_PRIVATE_USERCACHE 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_RANDOM_SOURCE Device to read random numbers from instead of using the random number |
︙ | ︙ | |||
72 73 74 75 76 77 78 | If defined, use BSD functions (such as funopen) instead of GNU functions (such as fopencookie), by adding emulations into the program. (It is still necessary to use a C compiler with GNU extensions though, even if the GNU library is not available.) CONFIG_USING_SDL12_COMPAT Define this if the program is to be compiled for use with the | | > | > | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | If defined, use BSD functions (such as funopen) instead of GNU functions (such as fopencookie), by adding emulations into the program. (It is still necessary to use a C compiler with GNU extensions though, even if the GNU library is not available.) CONFIG_USING_SDL12_COMPAT Define this if the program is to be compiled for use with the "sdl12-compat" SDL compatibility layer. (This does not affect linking, but it may change some parts of the program to improve compatibility.) CONFIG_USING_SDLCL Define this if the program is to be compiled for use with the "sdlcl" SDL compatibility layer. (This does not affect linking, but it may change some parts of the program to improve compatibility.) CONFIG_USING_X86_BMI2 If defined, use PDEP and PEXT instructions. This only works on x86 and only on some processor models. (Apparently this is fast on Intel but slow on AMD, so it should not be used on AMD, even if it is available.) CONFIG_WITH_VIDEO_RECORDING If defined, then include code to implement video recording, which will override some of the SDL functions (and some other functions), and might make them more slowly even if the video recording is not enabled. |
Modified fileformat.doc from [5da3136896] to [a630f0a978].
︙ | ︙ | |||
225 226 227 228 229 230 231 232 233 234 235 236 237 238 | * 85 to 169 = Heterogeneous run (1 to 85 pixels). Follow by that many bytes being the pixel values (palette index). * 170 to 254 = Copy-above run (1 to 85 pixels). Copies the specified number of pixels from the previous scanline. (If this crosses multiple scanlines, it continues copying it.) === xclass/*.WAV === A user-defined sound effect. The part of the lump name before the dot is the name used to refer to it in a class definition file; the exclamation mark is not included in the lump name. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | * 85 to 169 = Heterogeneous run (1 to 85 pixels). Follow by that many bytes being the pixel values (palette index). * 170 to 254 = Copy-above run (1 to 85 pixels). Copies the specified number of pixels from the previous scanline. (If this crosses multiple scanlines, it continues copying it.) === xclass/*.MUL === This lump is a "multidependent" lump. The lump name is ignored except for the MUL suffix, but it is displayed in the picture editor. The first four bytes are the number of bases and the number of filters in each of the three filter lists. All of these bytes have the number in the low 6-bits, and bit7 is set if it is nullable; bit6 is unused and it must be clear. After that is the list of bases, each being a null-terminated string, which must be the name of a .IMG lump without the .IMG suffix. After the list of bases is the information for each filter chain; first all chains in the first list, and then the second, and then the third; null chains are not listed. These records have the format: * A small-endian 16-bit number, where bit10-bit0 is the length of this filter chain in bytes, bit13-bit11 is the length of the name in bytes (not counting the ._- prefix), and bit15-bit14 is the prefix character (0 if none, 1 if a hyphen, 2 if a underscore, or 3 if a dot). * The name, not counting the prefix, with no terminator. After that will be the list of filters in each chain, in the same format as for DEP lumps but without the base name. === xclass/*.WAV === A user-defined sound effect. The part of the lump name before the dot is the name used to refer to it in a class definition file; the exclamation mark is not included in the lump name. |
︙ | ︙ |
Modified picedit.c from [86ecd14102] to [2327f052d7].
︙ | ︙ | |||
48 49 50 51 52 53 54 | ColorFilter color; OverlayFilter overlay; ShiftFilter shift; }; } Filter; typedef struct { | > | > > > > > > > > > > > > > > > > > > > > > > | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | ColorFilter color; OverlayFilter overlay; ShiftFilter shift; }; } Filter; typedef struct { union { char basename[64]; struct { // This nested struct is only used for multidependent pictures. char name[10]; Uint16 size; }; }; Filter filters[64]; Uint8 nfilters; } DependentPicture; typedef struct { char basename[64]; } BaseName; typedef struct { union { struct { Uint8 nbases; Uint8 nchains[3]; }; Uint8 nitems[4]; }; BaseName bases[63]; DependentPicture chains[3*63]; } MultiDependent; typedef struct { sqlite3_vtab_cursor super; int pos; } Cursor; static Uint8 cur_type; static Uint8 gsizes[16]; |
︙ | ︙ | |||
283 284 285 286 287 288 289 | static sqlite3_int64 ask_picture_id(const char*t) { sqlite3_stmt*st; const char*r=screen_prompt(t); int i; sqlite3_int64 id=0; if(!r || !*r) return 0; | | | 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | static sqlite3_int64 ask_picture_id(const char*t) { sqlite3_stmt*st; const char*r=screen_prompt(t); int i; sqlite3_int64 id=0; if(!r || !*r) return 0; i=sqlite3_prepare_v2(userdb,"SELECT `ID`, `TYPE` FROM `PICEDIT` WHERE `NAME`=?1||'.IMG' OR `NAME`=?1||'.DEP' OR (SUBSTR(?1,1,1)='+' AND `NAME`=SUBSTR(?1,2)||'.MUL');",-1,&st,0); if(i) { screen_message(sqlite3_errmsg(userdb)); return 0; } sqlite3_bind_text(st,1,r,-1,0); i=sqlite3_step(st); if(i==SQLITE_ROW) id=sqlite3_column_int64(st,0),cur_type=sqlite3_column_int(st,1); |
︙ | ︙ | |||
1107 1108 1109 1110 1111 1112 1113 | break; case SDL_VIDEOEXPOSE: goto redraw; } } } | | | > | | 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 | break; case SDL_VIDEOEXPOSE: goto redraw; } } } static void load_dependent_picture(const Uint8*data,int size,DependentPicture*dp,int mode) { FILE*fp; int i,j,k; if(!mode) memset(dp,0,sizeof(DependentPicture)); if(!size) { if(mode) return; const char*s=screen_prompt("Name of base picture:"); if(s) strncpy(dp->basename,s,63); return; } fp=fmemopen((Uint8*)data,size,"r"); if(!fp) fatal("Error with fmemopen\n"); i=0; if(!mode) for(;;) { j=fgetc(fp); if(j<32) { if(j>0) ungetc(j,fp); break; } if(i<63) dp->basename[i++]=j; } |
︙ | ︙ | |||
1159 1160 1161 1162 1163 1164 1165 | dp->filters[i].shift.nshift=k+1; break; } } fclose(fp); } | | | | 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 | dp->filters[i].shift.nshift=k+1; break; } } fclose(fp); } static void save_dependent_picture(FILE*fp,DependentPicture*dp,int mode) { int i,j; if(!mode) fwrite(dp->basename,1,strlen(dp->basename)+(dp->filters[0].code<32?0:1),fp); for(i=0;i<dp->nfilters;i++) { fputc(dp->filters[i].code,fp); switch(dp->filters[i].code) { case 8 ... 10: fputc(dp->filters[i].color.ncolors,fp); fwrite(dp->filters[i].color.colors,1,dp->filters[i].color.ncolors,fp); break; |
︙ | ︙ | |||
1367 1368 1369 1370 1371 1372 1373 | SDL_Rect r; SDL_Event ev; set_cursor(XC_arrow); redraw: r.x=r.y=0; r.w=screen->w; r.h=screen->h; SDL_LockSurface(screen); SDL_FillRect(screen,&r,0xF0); | > | | < < | | > > > > > > | 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 | SDL_Rect r; SDL_Event ev; set_cursor(XC_arrow); redraw: r.x=r.y=0; r.w=screen->w; r.h=screen->h; SDL_LockSurface(screen); SDL_FillRect(screen,&r,0xF0); if(name) { draw_text(0,0,"Dependent Image:",0xF0,0xF7); draw_text(136,0,name,0xF0,0xF5); draw_text(16,16,"Base:",0xF0,0xF7); draw_text(64,16,dp->basename,0xF0,0xFE); } else { draw_text(0,0,"Filter Chain",0xF0,0xF7); draw_text(16,16,"<Base>",0xF0,0xF8); } draw_text(0,8,"<ESC> Exit <\x18/\x19> Cursor <SP> Edit <INS> Insert <DEL> Delete",0xF0,0xFB); draw_text(0,16,c<0?"\x1A":"\xFA",0xF0,c<0?0xFA:0xF2); for(i=0,y=24;i<dp->nfilters;i++) { draw_text(0,y,c==i?"\x1A":"\xFA",0xF0,c==i?0xFA:0xF2); switch(j=dp->filters[i].code) { case 0 ... 7: draw_text(16,y,txt[j],0xF0,0xF7); y+=8; break; |
︙ | ︙ | |||
1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 | case SDLK_ESCAPE: return; case SDLK_UP: case SDLK_KP8: case SDLK_a: case SDLK_k: if(c>=0) --c; break; case SDLK_DOWN: case SDLK_KP2: case SDLK_z: case SDLK_j: ++c; break; case SDLK_INSERT: case SDLK_KP0: if(add_filter(dp,txt,c)) // maybe fallthrough case SDLK_SPACE: if(c==-1) { s=screen_prompt("Name of base picture:"); if(s && *s) strncpy(dp->basename,s,63); } else if(c<dp->nfilters) { switch(dp->filters[c].code) { case 8 ... 10: edit_color_filter(&dp->filters[c].color); break; | > | 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 | case SDLK_ESCAPE: return; case SDLK_UP: case SDLK_KP8: case SDLK_a: case SDLK_k: if(c>=0) --c; break; case SDLK_DOWN: case SDLK_KP2: case SDLK_z: case SDLK_j: ++c; break; case SDLK_INSERT: case SDLK_KP0: if(add_filter(dp,txt,c)) // maybe fallthrough case SDLK_SPACE: if(c==-1) { if(!name) break; s=screen_prompt("Name of base picture:"); if(s && *s) strncpy(dp->basename,s,63); } else if(c<dp->nfilters) { switch(dp->filters[c].code) { case 8 ... 10: edit_color_filter(&dp->filters[c].color); break; |
︙ | ︙ | |||
1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 | } goto redraw; case SDL_VIDEOEXPOSE: goto redraw; } } } static void edit_picture(sqlite3_int64 id) { sqlite3_stmt*st; Picture*pict[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; DependentPicture*dpict; char*name; const unsigned char*data; Uint8*buf=0; size_t size=0; FILE*fp; int i,n; if(i=sqlite3_prepare_v2(userdb,"SELECT SUBSTR(`NAME`,1,LENGTH(`NAME`)-4),`DATA`,`TYPE` FROM `PICEDIT` WHERE `ID`=?1;",-1,&st,0)) { | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 | } goto redraw; case SDL_VIDEOEXPOSE: goto redraw; } } } static void load_multidependent(const Uint8*data,int size,MultiDependent*mp) { Uint32 at=4; int i,j,k; memset(mp,0,sizeof(MultiDependent)); if(size<4) return; memcpy(mp->nitems,data,4); for(i=0;i<(mp->nbases&63);i++) { for(k=0;k<63 && at<size && data[at];k++) mp->bases[i].basename[k]=data[at++]; at++; } for(j=0;j<3;j++) for(i=0;i<(mp->nchains[j]&63) && at<size-2;i++) { k=data[at++]; k|=data[at++]<<8; mp->chains[j*63+i].size=k&0x07FF; mp->chains[j*63+i].name[0]="\x00-_."[k>>14]; k>>=11; if(at+(k&7)>size) break; memcpy(mp->chains[j*63+i].name+(k&~7?1:0),data+at,k&7); at+=k&7; } for(j=0;j<3;j++) for(i=0;i<(mp->nchains[j]&63) && at+mp->chains[j*63+i].size<=size;i++) { load_dependent_picture(data+at,mp->chains[j*63+i].size,mp->chains+j*63+i,1); at+=mp->chains[j*63+i].size; } } static void save_multidependent(FILE*fp,MultiDependent*mp) { Uint8*buf=0; size_t size=0; FILE*f=open_memstream((char**)&buf,&size); Uint32 at; int i,j,k,c; if(!f) fatal("Cannot open memory stream\n"); fwrite(mp->nitems,1,4,fp); for(i=0;i<(mp->nbases&63);i++) fwrite(mp->bases[i].basename,1,strlen(mp->bases[i].basename)+1,fp); for(j=0;j<3;j++) for(i=0;i<(mp->nchains[j]&63);i++) { at=ftell(f); save_dependent_picture(f,mp->chains+j*63+i,1); //TODO: This should check if it is too long, but unfortunately it does not do that. k=(ftell(f)-at)&0x07FF; c=mp->chains[j*63+i].name[0]; if(c=='-') k|=0x4000; if(c=='_') k|=0x8000; if(c=='.') k|=0xC000; k|=strlen(mp->chains[j*63+i].name+(k>>14?1:0))<<11; fputc(k,fp); fputc(k>>8,fp); if((k>>11)&7) fwrite(mp->chains[j*63+i].name+(k>>14?1:0),1,(k>>11)&7,fp); } fputc(0,f); fclose(f); if(!buf || !size) fatal("Allocation failed\n"); if(size) fwrite(buf,1,size-1,fp); free(buf); } static void edit_multidependent(MultiDependent*mp,const char*name) { const char*s; char row=0; char col=0; int i,j; SDL_Rect r; SDL_Event ev; set_cursor(XC_arrow); redraw: r.x=r.y=0; r.w=screen->w; r.h=screen->h; SDL_LockSurface(screen); SDL_FillRect(screen,&r,0xF0); draw_text(0,0,"Multidependent:",0xF0,0xF7); draw_text(136,0,name,0xF0,0xF5); draw_text(0,8,"<ESC> Exit <\x18/\x19/\x1A/\x1B> Cursor <SP> Edit <TAB> Name <BKSP> Toggle Null <INS> Add <DEL> Delete",0xF0,0xFB); draw_text(4,20,"BASE ",col==0?0xF2:0xF0,0xFE); if(mp->nbases&0x80) draw_text(4,28,"<Null>",0xF0,0xF7); draw_text(4+8*64,20,"I ",col==1?0xF2:0xF0,0xFE); if(mp->nchains[0]&0x80) draw_text(4+8*64,28,"<Null>",0xF0,0xF7); draw_text(4+8*74,20,"II ",col==2?0xF2:0xF0,0xFE); if(mp->nchains[1]&0x80) draw_text(4+8*74,28,"<Null>",0xF0,0xF7); draw_text(4+8*84,20,"III ",col==3?0xF2:0xF0,0xFE); if(mp->nchains[2]&0x80) draw_text(4+8*84,28,"<Null>",0xF0,0xF7); if(row>=(mp->nitems[col]&63)) row=(mp->nitems[col]&63?:1)-1; for(i=0;i<(mp->nbases&63);i++) draw_text(4,8*i+36,mp->bases[i].basename,(col==0 && row==i)?0xF1:0xF0,0xF7); for(j=0;j<3;j++) for(i=0;i<(mp->nchains[j]&63);i++) draw_text(4+8*(10*j+64),8*i+36,mp->chains[j*63+i].name,(col==j+1 && row==i)?0xF1:0xF0,0xF7); SDL_UnlockSurface(screen); SDL_Flip(screen); while(SDL_WaitEvent(&ev)) { switch(ev.type) { case SDL_QUIT: exit(0); break; case SDL_KEYDOWN: switch(ev.key.keysym.sym) { case SDLK_ESCAPE: case SDLK_q: return; case SDLK_BACKSPACE: case SDLK_t: mp->nitems[col]^=0x80; break; case SDLK_LEFT: case SDLK_KP4: case SDLK_h: if(col) --col; break; case SDLK_RIGHT: case SDLK_KP6: case SDLK_l: if(col<3) ++col; break; case SDLK_UP: case SDLK_KP8: case SDLK_k: if(row) --row; break; case SDLK_DOWN: case SDLK_KP2: case SDLK_j: ++row; break; case SDLK_HOME: case SDLK_KP7: row=0; break; case SDLK_END: case SDLK_KP1: row=64; break; case SDLK_INSERT: case SDLK_KP0: case SDLK_a: if((mp->nitems[col]&63)==63) break; row=mp->nitems[col]&63; s=screen_prompt(col?"Add filter chain:":"Add base item:"); if(!s || !*s) break; if(col) { strncpy(mp->chains[(col-1)*63+row].name,s,8); if(*s!='.' && *s!='_' && *s!='-') mp->chains[(col-1)*63+row].name[8]=0; mp->chains[(col-1)*63+row].nfilters=0; ++mp->nitems[col]; goto edit; } else { strncpy(mp->bases[row].basename,s,63); ++mp->nbases; } break; case SDLK_SPACE: case SDLK_e: edit: if(!mp->nitems[col]) break; if(!col) goto rename; edit_dependent_picture(mp->chains+(col-1)*63+row,0); break; case SDLK_DELETE: case SDLK_KP_PERIOD: case SDLK_d: if(!mp->nitems[col]) break; --mp->nitems[col]; if(col) { for(i=row;i<mp->nitems[col];i++) mp->chains[(col-1)*63+i]=mp->chains[(col-1)*63+i+1]; } else { for(i=row;i<mp->nbases;i++) mp->bases[i]=mp->bases[i+1]; } break; case SDLK_TAB: case SDLK_n: rename: if(!mp->nitems[col]) break; s=screen_prompt("Rename:"); if(!s || !*s) break; if(col) { strncpy(mp->chains[(col-1)*63+row].name,s,8); if(*s!='.' && *s!='_' && *s!='-') mp->chains[(col-1)*63+row].name[8]=0; mp->chains[(col-1)*63+row].nfilters=0; } else { strncpy(mp->bases[row].basename,s,63); } break; } goto redraw; case SDL_VIDEOEXPOSE: goto redraw; } } } static void edit_picture(sqlite3_int64 id) { sqlite3_stmt*st; Picture*pict[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; DependentPicture*dpict; MultiDependent*mpict; char*name; const unsigned char*data; Uint8*buf=0; size_t size=0; FILE*fp; int i,n; if(i=sqlite3_prepare_v2(userdb,"SELECT SUBSTR(`NAME`,1,LENGTH(`NAME`)-4),`DATA`,`TYPE` FROM `PICEDIT` WHERE `ID`=?1;",-1,&st,0)) { |
︙ | ︙ | |||
1516 1517 1518 1519 1520 1521 1522 | if(!buf || !size) fatal("Allocation failed\n"); *buf|=pict[0]->meth<<4; for(i=1;i<n;i++) buf[n+1+((i-1)>>1)]|=pict[i]->meth<<(i&1?0:4); for(i=0;i<16;i++) free(pict[i]); } else if(i==2) { dpict=malloc(sizeof(DependentPicture)); if(!dpict) fatal("Allocation failed\n"); | | | > > > > > > > > > > > | 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 | if(!buf || !size) fatal("Allocation failed\n"); *buf|=pict[0]->meth<<4; for(i=1;i<n;i++) buf[n+1+((i-1)>>1)]|=pict[i]->meth<<(i&1?0:4); for(i=0;i<16;i++) free(pict[i]); } else if(i==2) { dpict=malloc(sizeof(DependentPicture)); if(!dpict) fatal("Allocation failed\n"); load_dependent_picture(data,n,dpict,0); fp=open_memstream((char**)&buf,&size); if(!fp) fatal("Cannot open memory stream\n"); edit_dependent_picture(dpict,name); save_dependent_picture(fp,dpict,0); free(dpict); fclose(fp); if(!buf || !size) fatal("Allocation failed\n"); } else if(i==3) { mpict=malloc(sizeof(MultiDependent)); if(!mpict) fatal("Allocation failed\n"); load_multidependent(data,n,mpict); fp=open_memstream((char**)&buf,&size); if(!fp) fatal("Cannot open memory stream\n"); edit_multidependent(mpict,name); save_multidependent(fp,mpict); free(dpict); fclose(fp); if(!buf || !size) fatal("Allocation failed\n"); } free(name); if(i=sqlite3_prepare_v2(userdb,"UPDATE `PICEDIT` SET `DATA`=?2 WHERE ID=?1;",-1,&st,0)) { screen_message(sqlite3_errmsg(userdb)); |
︙ | ︙ |
Modified picedit.doc from [5b2aad712f] to [6c48fbb9a5].
︙ | ︙ | |||
12 13 14 15 16 17 18 | used; which one is used depends on the .altImage and .imageSize settings, which can be defined by the end user. === Main menu === The main menu displays the list of the names of all pictures. This list is | | > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | used; which one is used depends on the .altImage and .imageSize settings, which can be defined by the end user. === Main menu === The main menu displays the list of the names of all pictures. This list is sorted by name. Grey means a normal picture, green means dependent, and brown with a red plus sign in front means multidepenent. You can push escape to quit and save, or shift+escape quits without saving. The F1 key adds a picture. The F2 key deletes a picture by name. |
︙ | ︙ | |||
37 38 39 40 41 42 43 44 45 46 47 48 49 50 | create it with variants of all of those sizes. You can also specify the same numbers multiple times if you want multiple variants of that size. The F7 key copies a picture. The F12 key allows entering a SQL statement. If there are any result rows, only the first row and first column are displayed. === Drawing === The following keyboard commands are available: Esc | > > > > | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | create it with variants of all of those sizes. You can also specify the same numbers multiple times if you want multiple variants of that size. The F7 key copies a picture. The F12 key allows entering a SQL statement. If there are any result rows, only the first row and first column are displayed. Any of the prompts for picture names can start the picture name with a plus sign in order to affect a multidependent picture; see the below section about multidependent pictures for details. === Drawing === The following keyboard commands are available: Esc |
︙ | ︙ | |||
212 213 214 215 216 217 218 | * Base: This one must come first, and is the independent picture which will be used as the base; all other filters are applied to alter it. * Flip/rotation: Flip/rotate the picture. "Identity" also belongs to this category, but has no effect. | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | * Base: This one must come first, and is the independent picture which will be used as the base; all other filters are applied to alter it. * Flip/rotation: Flip/rotate the picture. "Identity" also belongs to this category, but has no effect. * Replace colours: A list of pairs of colours. The first of each pair is the old colour, and next the colour to replace it with. * Advance colours: A list of colours; change each colour mentioned in the list into the next colour in the list after that one. * Exchange colours: A list of pairs of colours; each colour is changed to the other colour in the pair. * Overlay: Paste the specified independent picture over the current picture, showing through wherever it is transparent. * Shift: Shift the picture. Specify the sizes and shift amounts in the format "size: shift"; each size also affects all multiples of that size, in which case the shift amount is also multiplied by the same amount. === Multidependent pictures === (This section describes a feature of which the editor is implemented, but it is not implemented in the game yet, as of this writing.) A multidependent picture lump defines several pictures which are formed from one or more independent pictures and filters, using common sets of base pictures and filter chains. You can define a list of up to 63 bases and up to three lists of filter chains each of which may contain up to 63 filter chains; all pictures are generated which take all combinations of one item from each list. Each list may be nullable. In this case, you can omit to choose an item from that list for forming a picture. Empty lists are automatically nullable, even if they have not been defined as nullable. Each picture is made from a base, followed by a filter chain in the first list, and then the second list, and then the third. The bases are names of independent pictures. The filter chains may have any names, up to seven characters; if the first character is a dot or underscore or hyphen, then they may be up to eight characters. The name of the resulting picture is then the name of the selected item of each list, in order, concatenated together (the name of the multidependent picture lump itself is not used). Each filter chain is defined in the same way as for dependent pictures, although you cannot specify a base name, because there isn't any. |