Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void runTCR()
- {
- if(!TCR_BM) return;
- tcr_cellhighlight = true;
- dword *ti_addr32 ; //tile image pixel address pointer
- dword *si_addr32 ; //source image pixel address pointer
- dword *osi_addr32; //old source image pixel address pointer
- dword c_col = 0 ;
- dword i,i2,i3,iw,ih ;
- dword nextrow,rowjump ; //number of pixels to skip in order to get to the next desired row of pixels
- //dword tilerow = bmpwidth/cellwidth;
- dword uniquetiles = 0; //also used as tile id
- dword uniquecolors = 0;
- dword ci_tilesize = cellwidth * cellheight; //bmpwidth * bmpheight * 4;//valid image dword size
- dword numFreeSlots = 100; // number of free tile slots to allocate, used in tiletransfers
- //etileset1.nextid;
- //dword tmp_tilecount= ci_tilecount;
- dword ddtstresult; //deduping/uniqueness test result
- dword bmpsize = bmpwidth * bmpheight; // total size of bitmap
- dword *colfreq; // color frequency list used in sorting colors into most used first
- dword nummetatiles = ci_tilecount/4;
- fmap* newmap = NULL;
- //dword tcrdirnamesize = strlen(getcwd(0,0)); // byte size of current image file directory name
- //dword tcrfilenamesize = strlen(TCR_filename); // byte size of current image file name
- bool tilematch;
- fmap *submapptr; //sub map/mini map data
- ftile *submtileptr; //sub map tiles
- TCR_PB->value = 0;
- TCR_PB->setUnits(ci_tilecount);
- // set up tile source names properly
- // ETSCALED2X
- TCR_FT->width = cellwidth * 2+2;
- TCR_FT->height = cellheight * 2+2;
- TCR_FT->updatePos(true);
- //msg(buildstr("%i",sizeof(char))); = 1 so give it 2
- //allocate temporary 32 bit bitmap data for initial image data copy
- byte* tmpmem_head = (byte*)malloc(((ci_tilecount) * (sizeof(bitmap)+4+4+2+2) * (strlen(getcwd(0,0))+strlen(TCR_filename)) +
- (ci_tilecount * 1024 * 4 )+(bmpsize *2) + 264))+sizeof(palette)+256*10;
- _messages__on = true;
- msg("here");
- //msg(buildstr("%i",sizeof(char))); = 1 so give it 2
- //allocate temporary 32 bit bitmap data for initial image data copy
- //byte* tmpmem_head = (byte*)malloc((ci_tilecount) * (sizeof(bitmap)+4+4+2+2+tcrdirnamesize + tcrfilenamesize) *
- // (ci_tilecount * ci_tilesize * 4)+32);
- /* [X] tmp bitmaps mem
- [X] isunique mem
- [X] bitmapimage mem
- [X] color freq. mem
- */
- ////
- byte* tmpmem = tmpmem_head;
- //allocate palette memory
- newpalette = (palette*)malloc(sizeof(palette)*5);
- newpalette->flags = palette_32bit;
- //newpalette->col32 = (dword*) malloc(bmpwidth * bmpheight*4); // seperately so we can realloc
- //set color frequency list data
- colfreq = (dword*)tmpmem;
- //memset(colfreq,0,bmpsize*4);
- tmpmem += 4* bmpsize;
- bitmap *tmp32bitbmp = (bitmap*)tmpmem;
- tmpmem += sizeof(bitmap) * ci_tilecount;
- //[NOTE] tmp32bitbmp[0] is used as a 32 temp comparison surface for the previously existing 8 bit tiles
- dword *isunique = (dword*)tmpmem;
- tmpmem+= 4 * ci_tilecount;
- dword *tmpflipvalues = (dword*)tmpmem;
- tmpmem+= 4 * ci_tilecount;
- //retreive free 32x32 tiles for tile data storage and final image storage
- /* -Retrieved here to :
- *allow me to generate linker data without a second pass
- *the extra tiles will be used by the bucket system next time tiles are needed
- -use array of pointers to buckets here so that :
- * i can delete tiles, push up the pointers and still access the newtiles as an array durring mapping and such
- then later on i can delete tiles, update the links and send them
- -...however to new tilesets need to be accessed as an array ?
- if not then ... allocate a new tileset linked list, and link all tilesets
- */
- //msg(buildstr("%i %i",sizeof(editertile32x32**),sizeof(editertile32x32)));
- //newtiles32x32 = (editertile32x32**)malloc(sizeof(editertile32x32) * ci_tilecount);
- //allocate newtile space
- newtiles32x32 = (editertile32x32**)malloc(ptrsize * (ci_tilecount+numFreeSlots));
- allocbucket(editertile32x32,newtiles32x32[0],flags,0x8,ci_tilecount,"new tiles");
- for(i = 1; i < ci_tilecount; i++) //[addition]32 additional slots for tiletransfers
- { allocbucket(editertile32x32,newtiles32x32[i],flags,0x8,1,"new tiles");
- }
- //allocate new metatile space
- if(TCR_CMT_CB->value)
- { newmetatiles = (editermetatile**)malloc(ptrsize * nummetatiles);
- allocbucket(editermetatile,newmetatiles[0],flags,0x8,nummetatiles,"new tiles");
- for(i = 1; i < nummetatiles; i++) //[addition]32 additional slots for tiletransfers
- { allocbucket(editermetatile,newmetatiles[i],flags,0x8,1,"new tiles");
- }
- }
- else newmetatiles = NULL;
- //retrieve sufficient free tile link data structure for rare 100% unique linkage cases
- linkedtiledata *tmplink;
- allocbucket(linkedtiledata,tmplink,flags,0x8,ci_tilecount,"new tile links");
- //retrieve and init a new tileset to store the new tiles in
- allocbucket(editertilecluster,newetileset.clusters[newtileclustercount],flags,0x8,10,"new tileset"); // assume we cut at least 10 images every time
- newetileset.clusters[newtileclustercount]->tiles32x32 = newtiles32x32;
- newetileset.clusters[newtileclustercount]->metatiles = newmetatiles;
- newetileset.clusters[newtileclustercount]->numFreeSlots = numFreeSlots ;
- //set the highlighter rect starting point
- hl_rectx = TCR_CI->actx1 + 2;
- hl_recty = TCR_CI->acty1 + 2;
- //init a new submap if needed
- dword tmptilesize = cellwidth;
- if(TCR_S2X_CB->value) tmptilesize*=2;
- if(TCR_GM_CB->value)
- { //allocbucket(fmap,newcuttermaps[newctrmapcount],flags,0x8,10,"new editersubmap");
- //allocbucket(fmap,newmap,flags,0x8,10,"new editersubmap");
- //newetileset.clusters[newtileclustercount]->submap = newmap;
- submapptr = &newetileset.clusters[newtileclustercount]->submap;
- submapptr->numLayers = 1;
- submapptr->layers[0].numCols = tilecols;
- submapptr->layers[0].numRows = tilerows;
- submapptr->layers[0].numTiles = ci_tilesize;
- submapptr->name = strdup(strtok(TCR_filename,"."));
- strcat(submapptr->name,"_submap");
- submapptr->layers[0].tiles = (ftile*)malloc(sizeof(ftile)*ci_tilecount);
- submapptr->layers[0].tileSize = tmptilesize;
- memset(submapptr->layers[0].tiles,0,sizeof(ftile)*ci_tilecount);
- submtileptr = submapptr->layers[0].tiles;
- }
- //init row progression data
- nextrow = TCR_BM->width - cellwidth; //X
- rowjump = TCR_BM->width - bmpwidth; //- 1 ? //take extra image x pixels left over into account
- si_addr32 = (dword*)TCR_BM->pixel; //X
- i = 0;
- //check for black in image
- i=0;
- do
- { if((*si_addr32 & 0x00ffffff))
- { newpalette->col_32[0] = 0; // first color is black [note] = 0;
- uniquecolors = 1;
- break;
- }
- si_addr32++;
- i++;
- }while(i < bmpsize);
- //build color palette for new tiles
- si_addr32 = (dword*)TCR_BM->pixel; //X
- i=0;
- ih = 0;
- iw = 0;
- //try{
- do
- { iw = 0;
- do
- { dword colormatch = false;
- for(i = 0; i < uniquecolors; i++)
- { if(uniquecolors > 256)goto end_palbuild;
- if(newpalette->col_32[i] == *si_addr32)
- { colormatch = true; break;}
- }
- ///if((*si_addr32 & 0x00ffffff) == 0)//ignore alpha
- //*si_addr32 = 0;
- //add new color
- if(!colormatch /*&& !((*si_addr32 & 0x00ffffff)==0)*/ )
- { newpalette->col_32[uniquecolors] = *si_addr32;
- //colfreq[uniquecolors]++;
- uniquecolors++;
- }
- //update frequency
- //else colfreq[i]++;
- si_addr32++;
- }while(iw++ < bmpwidth-1);
- si_addr32+=rowjump; // only get colors in the celled part of the image
- }while(ih++ < bmpheight-1);
- /*
- }catch(...)
- { msg("error",buildstr("(unique colors %i",uniquecolors));
- }
- */
- end_palbuild:
- //sort pal colors by frequency
- /*
- dword tmpnum;
- i = 0;
- i2 = 0;
- do
- { do
- { if(colfreq[i] < colfreq[i2])
- {
- //tmpnum = newpalette->col32[i2];
- //newpalette->col32[i2] = newpalette->col32[i];
- //newpalette->col32[i] = tmpnum;
- //swap
- //tmpnum = colfreq[i2];
- //colfreq[i2] = colfreq[i];
- //colfreq[i] = tmpnum;
- swapdw(newpalette->col_32[i2],newpalette->col_32[i]);
- swapdw(colfreq[i2],colfreq[i]);
- }
- }while(++i < uniquecolors);
- }while(++i2 < uniquecolors);
- */
- //newpalette->
- newpalette->size = uniquecolors;
- newpalette->flags |= bitmap_32bit;
- //realloc(newpalette->col32 , uniquecolors * 4);
- TCR_UC_LB->setname(buildstr("Unique Colors: %i",uniquecolors));
- i=0;
- //initialize bitmap and tile data
- for(int i2 = 0; i2 < ci_tilecount ; i2++) //&& i <1920 [for steve] i = 1966080 instead of under 1920 or ci_tilecount
- {
- //init bitmap data
- tmp32bitbmp[i2].pixel = tmpmem;
- tmpmem += (ci_tilesize*4);
- tmp32bitbmp[i2].width = cellwidth;
- tmp32bitbmp[i2].height = cellheight;
- tmp32bitbmp[i2].pitch = cellwidth + cellwidth;
- tmp32bitbmp[i2].psize = ci_tilesize;
- tmp32bitbmp[i2].flags = bitmap_32bit;
- //init links to NULL
- newtiles32x32[i2]->toplist = NULL;
- newtiles32x32[i2]->rightlist = NULL;
- newtiles32x32[i2]->bottomlist = NULL;
- newtiles32x32[i2]->leftlist = NULL;
- newtiles32x32[i2]->palnumber = 0;
- newtiles32x32[i2]->pal = newpalette;
- newtiles32x32[i2]->size = cellwidth*2;
- //newtiles32x32[i]->flags = 0;
- newtiles32x32[i2]->t_linkcount = 0;
- newtiles32x32[i2]->r_linkcount = 0;
- newtiles32x32[i2]->b_linkcount = 0;
- newtiles32x32[i2]->l_linkcount = 0;
- //set tiles source dir and file name
- //newtiles32x32[i]->srcpathname = strdup(getcwd(0,0));
- //newtiles32x32[i]->srcfilename = strdup(TCR_filename);
- }
- //initialize tileset data
- //newetileclusters[newtileclustercount]->pals = newpalette;
- newetileset.clusters[newtileclustercount]->pals = newpalette;
- //init bitmap data
- //init pixel transfer data
- osi_addr32= si_addr32 = (dword*)TCR_BM->pixel; //X
- ti_addr32 = (dword*)tmp32bitbmp[0].pixel; //X
- TCR_CO->setname("copying cells to tiles...");
- //process tiles
- //dword tmp;
- i = 0;
- do
- { ih = 0;
- do
- { //for(iw=0; ++iw < cellwidth; *ti_addr32++ = *si_addr32++);
- iw = 0;
- do
- { //copy & build checksum
- *ti_addr32 = *si_addr32; //unpalatized color copy
- newtiles32x32[i]->checksum += *si_addr32; //checksum build
- dword tmp = (dword)*si_addr32;
- //msg(buildstr("%i",*si_addr32));
- if((*si_addr32 & 0x00ffffff)==0 && !(newtiles32x32[i]->stdflags & TRANS))
- { newtiles32x32[i]->stdflags |= TRANS; //black pixel/set transparent flag
- // msg("trans");
- //*ti_addr32 = 0;//[note]edited out
- }
- si_addr32++;
- ti_addr32++;
- //deduplicate(phase 1) & map
- }while(++iw < cellwidth);
- si_addr32 += nextrow;
- }while(++ih < cellheight); //end 1 tile process
- si_addr32 -= nextrow;
- hl_rectx += cellwidth;
- //correct checksum for inflated images
- if(TCR_S2X_CB->value) newtiles32x32[i]->checksum *= 2;
- /*
- [note] this proves the tiles are copied properly initially
- drawbitmap(&tmp32bitbmp[0],0,0);
- update();
- while(true);
- */
- //end of row tile advance
- if(++c_col > tilecols-1)
- { c_col = 0;
- osi_addr32 = si_addr32 = si_addr32+rowjump;
- hl_recty+=cellheight;
- hl_rectx=TCR_CI->actx1 + 2;
- }
- //normal tile advance
- else osi_addr32 = si_addr32 = osi_addr32 + cellwidth;
- //check for uniqueness
- i2 = 0;
- bool tilematch = false;
- //test against new tiles
- while(i2 < i) //do
- { //checksum match test
- if(i != i2 && newtiles32x32[i]->checksum == newtiles32x32[i2]->checksum)
- { ddtstresult = ideduptest(&tmp32bitbmp[i],&tmp32bitbmp[i2],true,true);
- if(ddtstresult)
- { tilematch = true;
- //if(i == 0)msg("0");
- //isunique[i] = false;
- //note the flip value and use it for flagging that in the maps
- //but what if it's a flip of a tile in the map but a different flip of a tile
- //in the exisitng tileset ? gonna have to account for that
- //set sub map data
- submtileptr[i].id = newtiles32x32[i2]->id;
- //submtileptr[i].flipvalue = ddtstresult;
- tmpflipvalues[i] = ddtstresult;
- gettileflips(&submtileptr[i],ddtstresult);
- if(newtiles32x32[i2]->stdflags & TRANS)submtileptr[i].flags |=TRANS;
- //find ID number for this tile, if it exists
- settarget(tsttile32);
- if(TCR_S2X_CB->value)
- { scale32to32_2X(&tmp32bitbmp[i2]);
- newtiles32x32[i]->stdflags |= ETSCALED2X;
- }
- else
- { //blt32to32(&tmp32bitbmp[i2],0,0);
- memcpy(tsttile32->pixel,tmp32bitbmp[i2].pixel,ci_tilesize*4);
- }
- settarget(NULL);
- i3 = 1;
- while(i3 < tilecount)
- { settarget(tsttile32_2);
- drawetile32x32_32b(0,0,tilebank[i3]);
- settarget(NULL);
- ddtstresult = ideduptest(tsttile32,tsttile32_2,true,true);
- if(ddtstresult)
- { submtileptr[i].id = i3;
- gettileflips(&submtileptr[i],ddtstresult);
- if(tilebank[i3]->stdflags & TRANS)submtileptr[i].flags |=TRANS;
- }
- i3++;
- }
- break; //break since there is no need to find more matches
- }
- else
- { // rare case no pix match with color match
- }
- }
- i2++;
- }//while(i2++ < i) ??
- if(tilematch)
- { //i++;
- //continue;
- //mark tile as a dup
- }
- else //no match yet
- {
- //dedup(phase2): test against all previous unique tiles
- //scale tile image by X2
- /*notes:
- -make sure the first cell is copied over to tsttile32
- -make sure that all pal colors register properly every time
- -
- -
- -
- -
- */
- settarget(tsttile32);
- if(TCR_S2X_CB->value)
- {
- scale32to32_2X(&tmp32bitbmp[i2]);
- newtiles32x32[i]->stdflags |= ETSCALED2X;
- }
- else
- { memcpy(tsttile32->pixel,tmp32bitbmp[i2].pixel,ci_tilesize*4);
- }
- settarget(NULL);
- /*[note] this proves the first tile is being resized to 2X at this point
- drawbitmap(tsttile32,0,0);
- update();
- if(i == 0)msg("0");
- while(true);
- */
- TCR_FT->image = tsttile32;
- i2=1;
- //test against main tiles
- while(i2 < tilecount)
- { settarget(tsttile32_2);
- //drawetile32x32_32b(0,0,tilebank[i2]);
- settarget(NULL);
- //convert old tile to 32 bit for testing
- ddtstresult = ideduptest(tsttile32,tsttile32_2,true,true);
- if(ddtstresult)
- { tilematch = true;
- // msg("match");
- //note the flip value and use it for flagging that in the maps
- //but what if it's a flip of a tile in the map but a differnt flip of a tile
- //in the exisitng tileset ? gonna have to account for that
- //msg("match");
- isunique[i] = false;
- submtileptr[i].id = tilebank[i2]->id;
- // submtileptr[i].flipvalue = ddtstresult;
- //newtiles32x32[uniquetiles]->id = uniquetiles;
- tmpflipvalues[i] = ddtstresult;
- gettileflips(&submtileptr[i],ddtstresult);
- if(tilebank[i2]->stdflags & TRANS)submtileptr[i].flags |=TRANS;
- break; //break since there is no need to find more matches
- }
- else
- { isunique[i] = true;
- }
- //}//[x] end if
- i2++;
- }
- if(!tilematch)
- { //if(i==0)msg("0 no tilematch"); this point is reached
- //increase unique tile amount
- //submtileptr[i].id = newtiles32x32[i]->id = uniquetiles;
- //
- newetileset.clusters[newtileclustercount]->numTiles = uniquetiles;
- dword tmp_id = newetileset.gettileid(newetileset.numclusters+1);
- submtileptr[i].id = newtiles32x32[i]->id = tmp_id;
- TCR_UT_LB->setname(buildstr("Unique Tiles: %i",uniquetiles));
- //newtiles32x32[uniquetiles]->id = uniquetiles;
- newtiles32x32[uniquetiles]->id = tmp_id;
- //if(i==0)uniquetiles++;
- //if(uniquetiles)
- //{ if(i==0)msg("0 createtile");
- //8 bit palatize upscaled tile data to new tile
- byte *tpadrr8 = newtiles32x32[uniquetiles]->pixel;
- dword *cpyaddrr32 = (dword*)tsttile32->pixel;
- //TCR_FT->image = tsttile32;
- iw = 0;
- do
- { *tpadrr8++ = getpalentry32(newpalette,*cpyaddrr32++);
- }while(++iw < psize32X32);
- //}
- uniquetiles++;
- }//[x]
- //process unique tile?
- }
- //update gui
- //TCR_CT->image = &tmp32bitbmp[i];
- TCR_CT->image = &tmp32bitbmp[i];
- TCR_PB->increment();
- guiupdate();
- //msg(buildstr("tile: %i",i));
- //msg(buildstr("tile: %i",i));
- }while(++i < ci_tilecount);
- //TCR_CT->image = NULL;
- tcr_cellhighlight = false;
- //[NOTE]
- //handle metatiles
- if(TCR_CMT_CB->value)
- { dword mtid=1;
- //msg(buildstr("%i",tilerow));
- //for(i = 0; i < nummetatiles; i++)
- //{ /*
- // newmetatiles[i]->tiles[0] = newtiles32x32[mtid];
- // newmetatiles[i]->tiles[1] = newtiles32x32[mtid+1];
- // newmetatiles[i]->tiles[2] = newtiles32x32[mtid+tilerow];
- // newmetatiles[i]->tiles[3] = newtiles32x32[mtid+tilerow+1];
- // */
- //}
- dword mtilerows = tilerows/2;
- dword mtilecols = tilecols/2;
- //msg(buildstr("mrow %i, mcol %i",mtilerows, mtilecols));
- i=0;
- for(i2= 0; i2 < mtilerows; i2++)//caught
- { for(i3= 0; i3 < mtilecols; i3++)
- { newmetatiles[i]->id1 = mtid;
- newmetatiles[i]->id2 = mtid+1;
- newmetatiles[i]->id3 = mtid+tilecols;
- newmetatiles[i]->id4 = mtid+tilecols+1;
- newmetatiles[i++]->flags = 0;
- mtid+=2;
- }
- mtid+=tilecols;
- }
- // msg(buildstr("nummetatiles %i",i));
- }
- //generate new tile link data
- TCR_PB->value = 0;
- TCR_CO->setname("Generating Tile Link DataBase...");
- i = 0;
- ih = 0;
- //seperate loops to avoid ifs ?
- /*
- do
- { iw = 0;
- do
- { //update right links
- if(iw < tilecols-1)createtilelink(newtiles32x32[i],RIGHTLINK,newtiles32x32[i+1]->id,0);
- //update left links
- if(iw > 0)createtilelink(newtiles32x32[i],LEFTLINK,newtiles32x32[i-1]->id,0);
- //update top links
- if(ih > 0)createtilelink(newtiles32x32[i],TOPLINK,newtiles32x32[i-tilecols]->id,0);
- //update bottom links
- if(ih > tilerows-1)createtilelink(newtiles32x32[i],BOTTOMLINK,newtiles32x32[i+i+tilecols]->id,0);
- i++;
- TCR_PB->increment();
- guiupdate();
- //tiles32x32[i2]
- }while(++iw < tilecols);
- }while(++ih < tilerows); //end 1 tile process
- */
- //createtilelink(editertile32x32 *tile,dword linktype, dword id,dword flipvalue)
- //new
- /*
- do
- { iw = 0;
- do
- { //update right links
- if(iw < tilecols-1) // use subtimes as tilelist instead of new tile
- newtiles32x32[i]->r_linkcount += createtilelink(&newtiles32x32[i]->rightlist,submtileptr[i+1].id,submtileptr[i+1].flags); //submtileptr instead of newtile
- //update left links
- if(iw > 0)
- newtiles32x32[i]->l_linkcount += createtilelink(&newtiles32x32[i]->leftlist,submtileptr[i-1].id,submtileptr[i-1].flags);
- //update top links
- if(ih > 0)
- newtiles32x32[i]->t_linkcount += createtilelink(&newtiles32x32[i]->toplist,submtileptr[i-tilecols].id,submtileptr[i-tilecols].flags);
- //update bottom links
- if(ih > tilerows-1)
- newtiles32x32[i]->b_linkcount += createtilelink(&newtiles32x32[i]->bottomlist,submtileptr[i+tilecols].id,submtileptr[i+tilecols].flags);
- i++;
- TCR_PB->increment();
- guiupdate();
- }while(iw++ < tilecols);
- }while(ih++ < tilerows); //end 1 tile process
- */
- /*
- do
- { iw = 0;
- do
- { //update right links
- if(i < uniquetiles)
- {
- if(iw < tilecols-1) // use subtimes as tilelist instead of new tile
- newtiles32x32[i]->r_linkcount += createtilelink(&newtiles32x32[submtileptr[i].id]->rightlist,submtileptr[i+1].id,submtileptr[i+1].flags); //submtileptr instead of newtile
- //update left links
- if(iw > 0)
- newtiles32x32[i]->l_linkcount += createtilelink(&newtiles32x32[submtileptr[i].id]->leftlist,submtileptr[i-1].id,submtileptr[i-1].flags);
- //update top links
- if(ih > 0)
- newtiles32x32[i]->t_linkcount += createtilelink(&newtiles32x32[submtileptr[i].id]->toplist,submtileptr[i-tilecols].id,submtileptr[i-tilecols].flags);
- //update bottom links
- if(ih > tilerows-1)
- newtiles32x32[i]->b_linkcount += createtilelink(&newtiles32x32[submtileptr[i].id]->bottomlist,submtileptr[i+tilecols].id,submtileptr[i+tilecols].flags);
- //msg(buildstr("max %i, id %i",uniquetiles,submtileptr[i].id));
- }
- i++;
- TCR_PB->increment();
- guiupdate();
- }while(iw++ < tilecols);
- }while(ih++ < tilerows ); //end 1 tile process
- */
- // generate map
- /*
- -store map ids as pointers to the actual tiles ids
- *we will allready be pointing to the right numbers for ids from the main tiles by the end of the tile copy loop
- -when perfectly new tiles are deleted we set their map values to point to a 0 value for no tile
- -new tiles are in fact assigned their perminent id here when they are detected as new,
- * to address the problem of what to do when a new tile with a perm id is deleted, just subtract all subsequent tile ids
- for new tiles that followed that one by 1, that way the mini map ids will be updated automatically. problem solved.
- */
- /* i = 0;
- do
- {
- }while(++i < ci_tilecount);
- // illiminate duplicates within the new batch of tiles
- // TCR_CO->setname("deduplication (phase 1 : newtiles vs newtiles)...");
- /*CR_PB->value = 0;
- //free temp memory
- TCR_CT->image = NULL;
- free(tmpmem_head);
- //TSMaddnewtileset(newetilesets[newtilesetcount]);
- /*
- newetileclusters[newtileclustercount]->size = TCR_CS_LC->value;
- newetileclusters[newtileclustercount]->numTiles = uniquetiles;
- newetileclusters[newtileclustercount]->icontile32x32 = newtiles32x32[1];// change to 0
- */
- //handle pal data
- paletteconvert(newpalette,bitmap_16bit);
- etileset1.numpalettes++;
- newetileset.clusters[newtileclustercount]->size = TCR_CS_LC->value;
- newetileset.clusters[newtileclustercount]->numTiles = uniquetiles;
- newetileset.clusters[newtileclustercount]->numMetaTiles = nummetatiles;
- newetileset.clusters[newtileclustercount]->icontile32x32 = newtiles32x32[1];
- newetileset.clusters[newtileclustercount]->icontileID = 1;
- newetileset.clusters[newtileclustercount]->id = newtileclustercount;
- newetileset.totaltiles += uniquetiles;
- newtileclustercount++;
- newetileset.numclusters = newtileclustercount;
- //tksetmap(submapptr);
- //}catch(...)
- //{ msg("Tile cutter error", "generic");
- //}
- //TSM_P2->create
- //updateWTSM_M2();
- //msg("1");
- //msg(buildstr("%i",newtiles32x32[0]->id));
- //msg(buildstr("nummetatiles %i",nummetatiles));
- updateWTSM_M2_2();
- //TSM_MTM2->setItem1(0,buildstr("Name :\nSet : %i [Temp]\nTiles : %i",newtilesetcount,uniquetiles),tsmsetfolder,NULL,0);
- //FEIMAGE *tmpimage = TSM_MTM2->menu1.components
- showWTSM();
- // msg("end");
- return;
- }
Add Comment
Please, Sign In to add comment