Remove old duplicate_selected_sectors() function and copysector(), which

was only used there, from the source.

git-svn-id: https://svn.eduke32.com/eduke32@2139 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-11-26 22:40:39 +00:00
parent 2ce07bdcd2
commit 0414072838

View file

@ -212,7 +212,6 @@ static int16_t loopinside(int32_t x, int32_t y, int16_t startwall);
int32_t fillsector(int16_t sectnum, int32_t fillcolor); // fillcolor == -1: default (pulsating) int32_t fillsector(int16_t sectnum, int32_t fillcolor); // fillcolor == -1: default (pulsating)
static int16_t whitelinescan(int16_t sucksect, int16_t dalinehighlight); static int16_t whitelinescan(int16_t sucksect, int16_t dalinehighlight);
void printcoords16(int32_t posxe, int32_t posye, int16_t ange); void printcoords16(int32_t posxe, int32_t posye, int16_t ange);
//static void copysector(int16_t soursector, int16_t destsector, int16_t deststartwall, char copystat, const int16_t *oldtonewsect);
int32_t drawtilescreen(int32_t pictopleft, int32_t picbox); int32_t drawtilescreen(int32_t pictopleft, int32_t picbox);
void overheadeditor(void); void overheadeditor(void);
static int32_t getlinehighlight(int32_t xplc, int32_t yplc, int32_t line); static int32_t getlinehighlight(int32_t xplc, int32_t yplc, int32_t line);
@ -1903,134 +1902,6 @@ static void duplicate_selected_sectors(void)
yax_updategrays(pos.z); yax_updategrays(pos.z);
} }
#if 0
static void duplicate_selected_sectors(void)
{
int32_t i, j, startwall, endwall, newnumsectors, newwalls = 0;
int32_t minx=INT32_MAX, maxx=INT32_MIN, miny=INT32_MAX, maxy=INT32_MIN, dx, dy;
#ifdef YAX_ENABLE
int16_t cb, fb, hadextended=0;
#endif
for (i=0; i<highlightsectorcnt; i++)
newwalls += sector[highlightsector[i]].wallnum;
if (highlightsectorcnt + numsectors <= MAXSECTORS && numwalls+newwalls <= MAXWALLS)
{
int16_t *oldtonewsect = Bmalloc(numsectors * sizeof(int16_t));
if (oldtonewsect)
{
for (i=0; i<numsectors; i++)
oldtonewsect[i] = -1;
for (i=0; i<highlightsectorcnt; i++)
oldtonewsect[highlightsector[i]] = numsectors+i;
}
else
message("warning: out of memory!");
newnumsectors = numsectors;
newnumwalls = numwalls;
for (i=0; i<highlightsectorcnt; i++)
{
copysector(highlightsector[i], newnumsectors, newnumwalls, 1, oldtonewsect);
#ifdef YAX_ENABLE
yax_getbunches(highlightsector[i], &cb, &fb);
if (cb>=0 || fb>=0)
{
hadextended = 1;
// clearing yax-nextwalls has to be before setting the bunchnum to -1
// because the latter would automatically also clear the reverse (i.e.
// original) wall links
for (WALLS_OF_SECTOR(newnumsectors, j))
{
yax_setnextwall(j, 0, -1);
yax_setnextwall(j, 1, -1);
}
yax_setbunches(newnumsectors, -1, -1);
}
#endif
newnumsectors++;
newnumwalls += sector[highlightsector[i]].wallnum;
}
if (oldtonewsect)
Bfree(oldtonewsect);
Bmemset(hlsectorbitmap, 0, sizeof(hlsectorbitmap));
for (i=0; i<highlightsectorcnt; i++)
{
// first, make red lines of old selected sectors, effectively
// restoring the original state
for (WALLS_OF_SECTOR(highlightsector[i], j))
{
if (wall[j].nextwall >= 0)
checksectorpointer(wall[j].nextwall,wall[j].nextsector);
checksectorpointer(j, highlightsector[i]);
minx = min(minx, wall[j].x);
maxx = max(maxx, wall[j].x);
miny = min(miny, wall[j].y);
maxy = max(maxy, wall[j].y);
}
// Then, highlight the ones just copied.
// These will have all walls whited out.
j = numsectors + i;
hlsectorbitmap[j>>3] |= (1<<(j&7));
}
// displace walls of new sectors by a small amount
if (grid>0 && grid<9)
dx = max(2048>>grid, 128);
else
dx = 512;
dy = -dx;
if (maxx+dx >= editorgridextent) dx*=-1;
if (minx+dx <= -editorgridextent) dx*=-1;
if (maxy+dy >= editorgridextent) dy*=-1;
if (miny+dy <= -editorgridextent) dy*=-1;
for (i=numsectors; i<newnumsectors; i++)
{
for (j=sector[i].wallptr; j<sector[i].wallptr+sector[i].wallnum; j++)
{
wall[j].x += dx;
wall[j].y += dy;
}
for (j=headspritesect[i]; j>=0; j=nextspritesect[j])
{
sprite[j].x += dx;
sprite[j].y += dy;
}
}
numsectors = newnumsectors;
numwalls = newnumwalls;
update_highlightsector(); // must be after numsectors = newnumsectors
newnumwalls = -1;
newnumsectors = -1;
updatenumsprites();
#ifdef YAX_ENABLE
if (hadextended)
printmessage16("Sectors duplicated and stamped, clearing extensions.");
else
#endif
printmessage16("Sectors duplicated and stamped.");
asksave = 1;
}
else
{
printmessage16("Copying sectors would exceed sector or wall limit.");
}
}
#endif
static void duplicate_selected_sprites(void) static void duplicate_selected_sprites(void)
{ {
@ -9831,104 +9702,6 @@ void updatenumsprites(void)
numsprites += (sprite[i].statnum != MAXSTATUS); numsprites += (sprite[i].statnum != MAXSTATUS);
} }
#if 0
static void copysector(int16_t soursector, int16_t destsector, int16_t deststartwall, char copystat,
const int16_t *oldtonewsect)
{
int16_t i, j, k, m, newnumwalls, startwall, endwall;
newnumwalls = deststartwall; //erase existing sector fragments
//duplicate walls
startwall = sector[soursector].wallptr;
endwall = startwall + sector[soursector].wallnum;
for (j=startwall; j<endwall; j++)
{
Bmemcpy(&wall[newnumwalls], &wall[j], sizeof(walltype));
wall[newnumwalls].point2 += deststartwall-startwall;
if (wall[newnumwalls].nextwall < 0)
{
onextwall[newnumwalls] = onextwall[j];
}
else
{
k = wall[newnumwalls].nextsector;
if (oldtonewsect && oldtonewsect[k]>=0)
{
wall[newnumwalls].nextsector = oldtonewsect[k];
m = 0;
for (i=0; i<highlightsectorcnt; i++)
{
if (highlightsector[i]==k)
break;
m += sector[highlightsector[i]].wallnum;
}
if (i==highlightsectorcnt)
{
message("internal error in copysector(): i==highlightsectorcnt");
goto nonextsector;
}
else if (highlightsector[i]==soursector)
{
message("internal error in copysector(): highlightsector[i]==soursector");
goto nonextsector;
}
wall[newnumwalls].nextwall = numwalls + m + (wall[j].nextwall-sector[k].wallptr);
}
else
{
nonextsector:
wall[newnumwalls].nextsector = -1;
wall[newnumwalls].nextwall = -1;
}
// the below code is incorrect in the general case since, in a set of
// selected sectors, the order may not be the same as the destination ones
// wall[newnumwalls].nextwall += deststartwall-startwall;
// wall[newnumwalls].nextsector += destsector-soursector;
}
newnumwalls++;
}
//for(j=deststartwall;j<newnumwalls;j++)
//{
// if (wall[j].nextwall >= 0)
// checksectorpointer(wall[j].nextwall,wall[j].nextsector);
// checksectorpointer((short)j,destsector);
//}
if (newnumwalls > deststartwall)
{
//duplicate sectors
Bmemcpy(&sector[destsector],&sector[soursector],sizeof(sectortype));
sector[destsector].wallptr = deststartwall;
sector[destsector].wallnum = newnumwalls-deststartwall;
if (copystat == 1)
{
//duplicate sprites
j = headspritesect[soursector];
while (j >= 0)
{
m = insertsprite(destsector,sprite[j].statnum);
if (m<0)
{
message("Some sprites not duplicated because limit was reached.");
break;
}
Bmemcpy(&sprite[m],&sprite[j],sizeof(spritetype));
sprite[m].sectnum = destsector; //Don't let memcpy overwrite sector!
j = nextspritesect[j];
}
}
}
}
#endif
#define DOPRINT(Yofs, fmt, ...) \ #define DOPRINT(Yofs, fmt, ...) \
Bsprintf(snotbuf, fmt, ## __VA_ARGS__); \ Bsprintf(snotbuf, fmt, ## __VA_ARGS__); \
printext16(8+col*200, ydim/*-(row*96)*/-STATUS2DSIZ+Yofs, color, -1, snotbuf, 0); printext16(8+col*200, ydim/*-(row*96)*/-STATUS2DSIZ+Yofs, color, -1, snotbuf, 0);