mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
TROR: join sectors to a new bunch. For this, highlight exactly two connected components having the same outline and being TROR-consistent (same height etc.) and press Ctrl-J. Any ambiguity (connect c/f with f/c?, move which component?) is resolved by asking the user. Warning: hot off the keyboard and likely buggy
git-svn-id: https://svn.eduke32.com/eduke32@1895 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
4fb043483d
commit
68dff06533
4 changed files with 232 additions and 65 deletions
|
@ -214,7 +214,9 @@ extern int32_t lastpm16time;
|
||||||
|
|
||||||
extern char lastpm16buf[156];
|
extern char lastpm16buf[156];
|
||||||
|
|
||||||
int32_t editor_ask_function(const char *question, char *dachars, int32_t numchars);
|
int32_t fillsector(int16_t sectnum, int32_t fillcolor);
|
||||||
|
int32_t ask_if_sure(const char *query, uint32_t flags);
|
||||||
|
int32_t editor_ask_function(const char *question, const char *dachars, int32_t numchars);
|
||||||
|
|
||||||
void spriteoncfz(int32_t i, int32_t *czptr, int32_t *fzptr);
|
void spriteoncfz(int32_t i, int32_t *czptr, int32_t *fzptr);
|
||||||
void DoSpriteOrnament(int32_t i);
|
void DoSpriteOrnament(int32_t i);
|
||||||
|
@ -224,6 +226,7 @@ int32_t getpointhighlight(int32_t xplc, int32_t yplc, int32_t point);
|
||||||
void update_highlight(void);
|
void update_highlight(void);
|
||||||
void update_highlightsector(void);
|
void update_highlightsector(void);
|
||||||
|
|
||||||
|
int32_t inside_editor_curpos(int16_t sectnum);
|
||||||
int32_t inside_editor(const vec3_t *pos, int32_t searchx, int32_t searchy, int32_t zoom,
|
int32_t inside_editor(const vec3_t *pos, int32_t searchx, int32_t searchy, int32_t zoom,
|
||||||
int32_t x, int32_t y, int16_t sectnum);
|
int32_t x, int32_t y, int16_t sectnum);
|
||||||
void correct_sprite_yoffset(int32_t i);
|
void correct_sprite_yoffset(int32_t i);
|
||||||
|
|
|
@ -514,40 +514,36 @@ int32_t app_main(int32_t argc, const char **argv)
|
||||||
// init dummy texture for YAX
|
// init dummy texture for YAX
|
||||||
// must be after loadpics(), which inits BUILD's cache
|
// must be after loadpics(), which inits BUILD's cache
|
||||||
|
|
||||||
for (i=MAXTILES-1; i>=MAXTILES-2; i--)
|
i = MAXTILES-1;
|
||||||
if (tilesizx[i]==0 && tilesizy[i]==0)
|
if (tilesizx[i]==0 && tilesizy[i]==0)
|
||||||
{
|
{
|
||||||
static char R[8*16] = { //
|
static char R[8*16] = { //
|
||||||
0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0,
|
0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0,
|
||||||
0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0,
|
0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0,
|
||||||
0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0,
|
0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0,
|
||||||
0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0,
|
0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0,
|
||||||
0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0,
|
0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0,
|
||||||
0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0,
|
0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0,
|
||||||
0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0,
|
0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
char *newtile;
|
char *newtile;
|
||||||
int32_t sx=32, sy=32, col, j;
|
int32_t sx=32, sy=32, col, j;
|
||||||
|
|
||||||
walock[i] = 255; // permanent tile
|
walock[i] = 255; // permanent tile
|
||||||
picsiz[i] = 5 + (5<<4);
|
picsiz[i] = 5 + (5<<4);
|
||||||
tilesizx[i] = sx; tilesizy[i] = sy;
|
tilesizx[i] = sx; tilesizy[i] = sy;
|
||||||
allocache(&waloff[i], sx*sy, &walock[i]);
|
allocache(&waloff[i], sx*sy, &walock[i]);
|
||||||
newtile = (char *)waloff[i];
|
newtile = (char *)waloff[i];
|
||||||
|
|
||||||
if (i==MAXTILES-1)
|
col = getclosestcol(128>>2, 128>>2, 0);
|
||||||
col = getclosestcol(128>>2, 128>>2, 0);
|
for (j=0; j<(signed)sizeof(R); j++)
|
||||||
else
|
R[j] *= col;
|
||||||
col = getclosestcol(63, 0, 63);
|
|
||||||
for (j=0; j<(signed)sizeof(R); j++)
|
|
||||||
if (R[j])
|
|
||||||
R[j] = col;
|
|
||||||
|
|
||||||
Bmemset(newtile, 0, sx*sy);
|
Bmemset(newtile, 0, sx*sy);
|
||||||
for (j=0; j<8; j++)
|
for (j=0; j<8; j++)
|
||||||
Bmemcpy(&newtile[32*j], &R[16*j], 16);
|
Bmemcpy(&newtile[32*j], &R[16*j], 16);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Bstrcpy(kensig,"Uses BUILD technology by Ken Silverman");
|
Bstrcpy(kensig,"Uses BUILD technology by Ken Silverman");
|
||||||
|
@ -1322,8 +1318,9 @@ char changechar(char dachar, int32_t dadir, char smooshyalign, char boundcheck)
|
||||||
|
|
||||||
////////////////////// OVERHEADEDITOR //////////////////////
|
////////////////////// OVERHEADEDITOR //////////////////////
|
||||||
|
|
||||||
static int32_t inside_editor_curpos(int16_t sectnum)
|
int32_t inside_editor_curpos(int16_t sectnum)
|
||||||
{
|
{
|
||||||
|
// TODO: take care: mous[xy]plc global vs overheadeditor auto
|
||||||
return inside_editor(&pos, searchx,searchy, zoom, mousxplc,mousyplc, sectnum);
|
return inside_editor(&pos, searchx,searchy, zoom, mousxplc,mousyplc, sectnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1922,17 +1919,26 @@ void correct_sprite_yoffset(int32_t i)
|
||||||
sprite[i].yoffset = 0;
|
sprite[i].yoffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// keepcol >= 0 && <256: keep that idx-color
|
||||||
|
// keepcol < 0: keep none
|
||||||
|
// keepcol >= 256: 0x00ffffff is mask for 3 colors
|
||||||
void fade_editor_screen(int32_t keepcol)
|
void fade_editor_screen(int32_t keepcol)
|
||||||
{
|
{
|
||||||
char blackcol=editorcolors[0], greycol=whitecol-25, *cp;
|
char blackcol=0, greycol=whitecol-25, *cp;
|
||||||
int32_t i;
|
int32_t pix, i, threecols = (keepcol >= 256);
|
||||||
|
char cols[3] = {keepcol&0xff, (keepcol>>8)&0xff, (keepcol>>16)&0xff};
|
||||||
|
|
||||||
begindrawing();
|
begindrawing();
|
||||||
cp = (char *)frameplace;
|
cp = (char *)frameplace;
|
||||||
for (i=0; i<bytesperline*(ydim-STATUS2DSIZ2); i++, cp++)
|
for (i=0; i<bytesperline*(ydim-STATUS2DSIZ2); i++, cp++)
|
||||||
{
|
{
|
||||||
if ((int32_t)(*cp) == keepcol)
|
pix = (uint8_t)(*cp);
|
||||||
|
|
||||||
|
if (!threecols && pix == keepcol)
|
||||||
continue;
|
continue;
|
||||||
|
if (threecols)
|
||||||
|
if (pix==cols[0] || pix==cols[1] || pix==cols[2])
|
||||||
|
continue;
|
||||||
|
|
||||||
if (*cp==greycol)
|
if (*cp==greycol)
|
||||||
*cp = blackcol;
|
*cp = blackcol;
|
||||||
|
@ -2046,7 +2052,6 @@ static void updatesprite1(int16_t i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t ask_if_sure(const char *query, uint32_t flags);
|
|
||||||
#ifdef YAX_ENABLE
|
#ifdef YAX_ENABLE
|
||||||
static int32_t ask_above_or_below(void);
|
static int32_t ask_above_or_below(void);
|
||||||
#endif
|
#endif
|
||||||
|
@ -2252,21 +2257,37 @@ static int32_t collnumsects[2];
|
||||||
static int16_t collsectlist[2][MAXSECTORS];
|
static int16_t collsectlist[2][MAXSECTORS];
|
||||||
static uint8_t collsectbitmap[2][MAXSECTORS>>3];
|
static uint8_t collsectbitmap[2][MAXSECTORS>>3];
|
||||||
|
|
||||||
static void collect_sectors1(int16_t *sectlist, uint8_t *sectbitmap, int32_t *numsectptr, int16_t startsec)
|
static void collect_sectors1(int16_t *sectlist, uint8_t *sectbitmap, int32_t *numsectptr,
|
||||||
|
int16_t startsec, int32_t alsoyaxnext)
|
||||||
{
|
{
|
||||||
int32_t j, startwall, endwall, sectcnt;
|
int32_t j, startwall, endwall, sectcnt;
|
||||||
|
|
||||||
bfirst_search_init(sectlist, sectbitmap, numsectptr, MAXSECTORS, startsec);
|
bfirst_search_init(sectlist, sectbitmap, numsectptr, MAXSECTORS, startsec);
|
||||||
|
|
||||||
for (sectcnt=0; sectcnt<*numsectptr; sectcnt++)
|
for (sectcnt=0; sectcnt<*numsectptr; sectcnt++)
|
||||||
|
{
|
||||||
for (WALLS_OF_SECTOR(sectlist[sectcnt], j))
|
for (WALLS_OF_SECTOR(sectlist[sectcnt], j))
|
||||||
bfirst_search_try(sectlist, sectbitmap, numsectptr, wall[j].nextsector);
|
bfirst_search_try(sectlist, sectbitmap, numsectptr, wall[j].nextsector);
|
||||||
|
|
||||||
|
if (alsoyaxnext)
|
||||||
|
{
|
||||||
|
int16_t bn[2], cf;
|
||||||
|
yax_getbunches(sectlist[sectcnt], &bn[0], &bn[1]);
|
||||||
|
for (cf=0; cf<2; cf++)
|
||||||
|
if (bn[cf]>=0)
|
||||||
|
{
|
||||||
|
for (SECTORS_OF_BUNCH(bn[cf], !cf, j))
|
||||||
|
bfirst_search_try(sectlist, sectbitmap, numsectptr, j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// whether all highlighted sectors are in one (returns 1), two (2)
|
// whether all highlighted sectors are in one (returns 1), two (2)
|
||||||
// or more (>2) connected components wrt the nextsector relation
|
// or more (>2) connected components wrt the nextsector relation
|
||||||
// -1 means error
|
// -1 means error
|
||||||
static int32_t highlighted_sectors_components(void)
|
// alsoyaxnext: also consider "yax-nextsector" relation
|
||||||
|
static int32_t highlighted_sectors_components(int32_t alsoyaxnext)
|
||||||
{
|
{
|
||||||
int32_t j, k, tmp;
|
int32_t j, k, tmp;
|
||||||
|
|
||||||
|
@ -2276,7 +2297,8 @@ static int32_t highlighted_sectors_components(void)
|
||||||
if (highlightsectorcnt==1)
|
if (highlightsectorcnt==1)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
collect_sectors1(collsectlist[0], collsectbitmap[0], &collnumsects[0], highlightsector[0]);
|
collect_sectors1(collsectlist[0], collsectbitmap[0], &collnumsects[0],
|
||||||
|
highlightsector[0], alsoyaxnext);
|
||||||
|
|
||||||
for (k=0; k<highlightsectorcnt; k++)
|
for (k=0; k<highlightsectorcnt; k++)
|
||||||
{
|
{
|
||||||
|
@ -2284,7 +2306,8 @@ static int32_t highlighted_sectors_components(void)
|
||||||
if ((collsectbitmap[0][j>>3]&(1<<(j&7)))==0)
|
if ((collsectbitmap[0][j>>3]&(1<<(j&7)))==0)
|
||||||
{
|
{
|
||||||
// sector j not collected --> more than 1 conn. comp.
|
// sector j not collected --> more than 1 conn. comp.
|
||||||
collect_sectors1(collsectlist[1], collsectbitmap[1], &collnumsects[1], j);
|
collect_sectors1(collsectlist[1], collsectbitmap[1], &collnumsects[1],
|
||||||
|
j, alsoyaxnext);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2307,7 +2330,6 @@ static int32_t highlighted_sectors_components(void)
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static int cmpgeomwal1(const int16_t *w1, const int16_t *w2)
|
static int cmpgeomwal1(const int16_t *w1, const int16_t *w2)
|
||||||
{
|
{
|
||||||
const walltype *wal1 = &wall[*w1];
|
const walltype *wal1 = &wall[*w1];
|
||||||
|
@ -2324,7 +2346,6 @@ static void sort_walls_geometrically(int16_t *wallist, int32_t nwalls)
|
||||||
qsort(wallist, nwalls, sizeof(int16_t), (int(*)(const void *, const void *))&cmpgeomwal1);
|
qsort(wallist, nwalls, sizeof(int16_t), (int(*)(const void *, const void *))&cmpgeomwal1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
void overheadeditor(void)
|
void overheadeditor(void)
|
||||||
{
|
{
|
||||||
|
@ -3171,7 +3192,7 @@ void overheadeditor(void)
|
||||||
goto end_yax;
|
goto end_yax;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (highlighted_sectors_components() != 1)
|
if (highlighted_sectors_components(0) != 1)
|
||||||
{
|
{
|
||||||
message("Sectors to extend must be in one connected component");
|
message("Sectors to extend must be in one connected component");
|
||||||
goto end_yax;
|
goto end_yax;
|
||||||
|
@ -4269,18 +4290,19 @@ end_point_dragging:
|
||||||
goto end_join_sectors;
|
goto end_join_sectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#ifdef YAX_ENABLE
|
||||||
//def YAX_ENABLE
|
|
||||||
if (highlightsectorcnt > 0 && eitherCTRL)
|
if (highlightsectorcnt > 0 && eitherCTRL)
|
||||||
{
|
{
|
||||||
// [component][ceiling(0) or floor(1)]
|
// [component][ceiling(0) or floor(1)]
|
||||||
// compstat: &1: "has extension", &2: "differ in z", &4: "sloped"
|
// compstat: &1: "has extension", &2: "differ in z", &4: "sloped", -1: "uninited"
|
||||||
int32_t cf, comp, compstat[2][2]={{0,0},{0,0}}, compcfz[2][2];
|
int32_t cf, comp, compstat[2][2]={{-1,-1},{-1,-1}}, compcfz[2][2];
|
||||||
|
|
||||||
// joinstat:
|
// joinstat: join what to what?
|
||||||
// &1: ceil(comp 0) <-> flor(comp 1), &2: flor(comp 0) <-> ceil(comp 1)
|
// &1: ceil(comp 0) <-> flor(comp 1), &2: flor(comp 0) <-> ceil(comp 1)
|
||||||
// (doesn't yet say which is stationary)
|
// (doesn't yet say which is stationary)
|
||||||
int32_t joinstat, needsdisp, dx,dy,dz;
|
// movestat: which component can be displaced?
|
||||||
|
// &1: first, &2: second
|
||||||
|
int32_t askres, joinstat, needsdisp, movestat, dx=0,dy=0,dz;
|
||||||
|
|
||||||
// tempxyar: int32_t [MAXWALLS][2]
|
// tempxyar: int32_t [MAXWALLS][2]
|
||||||
int32_t numouterwalls[2] = {0,0}, numowals;
|
int32_t numouterwalls[2] = {0,0}, numowals;
|
||||||
|
@ -4296,7 +4318,7 @@ end_point_dragging:
|
||||||
|
|
||||||
// first, see whether we have exactly two connected components
|
// first, see whether we have exactly two connected components
|
||||||
// wrt wall[].nextsector
|
// wrt wall[].nextsector
|
||||||
if (highlighted_sectors_components() != 2)
|
if (highlighted_sectors_components(0) != 2)
|
||||||
{
|
{
|
||||||
message("Sectors must be partitioned in two components to join");
|
message("Sectors must be partitioned in two components to join");
|
||||||
goto end_join_sectors;
|
goto end_join_sectors;
|
||||||
|
@ -4309,8 +4331,11 @@ end_point_dragging:
|
||||||
|
|
||||||
for (cf=0; cf<2; cf++)
|
for (cf=0; cf<2; cf++)
|
||||||
{
|
{
|
||||||
if (k==0)
|
if (compstat[comp][cf]==-1)
|
||||||
|
{
|
||||||
|
compstat[comp][cf] = 0;
|
||||||
compcfz[comp][cf] = SECTORFLD(j,z, cf);
|
compcfz[comp][cf] = SECTORFLD(j,z, cf);
|
||||||
|
}
|
||||||
|
|
||||||
if (yax_getbunch(j, cf)>=0)
|
if (yax_getbunch(j, cf)>=0)
|
||||||
compstat[comp][cf] |= 1;
|
compstat[comp][cf] |= 1;
|
||||||
|
@ -4333,6 +4358,7 @@ end_point_dragging:
|
||||||
if (joinstat==0)
|
if (joinstat==0)
|
||||||
{
|
{
|
||||||
message("No consistent joining combination found");
|
message("No consistent joining combination found");
|
||||||
|
//for (i=0; i<2; i++) for (j=0; j<2; j++) message("%d", compstat[i][j]);
|
||||||
goto end_join_sectors;
|
goto end_join_sectors;
|
||||||
}
|
}
|
||||||
if (joinstat==3)
|
if (joinstat==3)
|
||||||
|
@ -4366,7 +4392,6 @@ end_point_dragging:
|
||||||
for (comp=0; comp<2; comp++)
|
for (comp=0; comp<2; comp++)
|
||||||
sort_walls_geometrically(outerwall[comp], numouterwalls[comp]);
|
sort_walls_geometrically(outerwall[comp], numouterwalls[comp]);
|
||||||
|
|
||||||
needsdisp = 0;
|
|
||||||
for (k=0; k<numowals; k++)
|
for (k=0; k<numowals; k++)
|
||||||
{
|
{
|
||||||
wal0 = &wall[outerwall[0][k]];
|
wal0 = &wall[outerwall[0][k]];
|
||||||
|
@ -4386,6 +4411,121 @@ end_point_dragging:
|
||||||
goto end_join_sectors;
|
goto end_join_sectors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (joinstat == 3)
|
||||||
|
{
|
||||||
|
char askchars[2] = {'1', 'v'};
|
||||||
|
|
||||||
|
// now is a good time to ask...
|
||||||
|
for (comp=0; comp<2; comp++)
|
||||||
|
for (k=0; k<collnumsects[comp]; k++)
|
||||||
|
fillsector(collsectlist[comp][k], comp==0 ? 159 : editorcolors[11]);
|
||||||
|
|
||||||
|
fade_editor_screen(editorcolors[11] | (159<<8));
|
||||||
|
askres = editor_ask_function("Connect yellow ceil w/ blue floor (1) or (v)ice versa?", askchars, 2);
|
||||||
|
if (askres==-1)
|
||||||
|
goto end_join_sectors;
|
||||||
|
joinstat &= (1<<askres);
|
||||||
|
}
|
||||||
|
|
||||||
|
joinstat--; // 0:ceil(0)<->flor(1), 1:ceil(1)<->flor(0)
|
||||||
|
|
||||||
|
dz = compcfz[1][!joinstat] - compcfz[0][joinstat];
|
||||||
|
needsdisp = (dx || dy || dz);
|
||||||
|
|
||||||
|
if (needsdisp)
|
||||||
|
{
|
||||||
|
// a component can be displaced if it's not extended on the non-joining side
|
||||||
|
movestat = (compstat[0][!joinstat]^1) | ((compstat[1][joinstat]^1)<<1);
|
||||||
|
if (!movestat)
|
||||||
|
{
|
||||||
|
message("Internal error while TROR-joining: movestat inconsistent!");
|
||||||
|
goto end_join_sectors;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (movestat==3)
|
||||||
|
{
|
||||||
|
char askchars[2] = {'y', 'b'};
|
||||||
|
|
||||||
|
for (comp=0; comp<2; comp++)
|
||||||
|
for (k=0; k<collnumsects[comp]; k++)
|
||||||
|
fillsector(collsectlist[comp][k], comp==0 ? 159 : editorcolors[11]);
|
||||||
|
|
||||||
|
fade_editor_screen(editorcolors[11] | (159<<8));
|
||||||
|
askres = editor_ask_function("Move (y)ellow or (b)lue component?", askchars, 2);
|
||||||
|
if (askres==-1)
|
||||||
|
goto end_join_sectors;
|
||||||
|
movestat &= (1<<askres);
|
||||||
|
}
|
||||||
|
|
||||||
|
movestat--; // 0:move 1st, 1:move 2nd component
|
||||||
|
if (movestat==1)
|
||||||
|
dx*=-1, dy*=-1, dz*=-1;
|
||||||
|
|
||||||
|
// now need to collect them wrt. the nextsector but also
|
||||||
|
// the yax-nextsector relation
|
||||||
|
if (highlighted_sectors_components(1) != 2)
|
||||||
|
{
|
||||||
|
message("Must not have TROR connections between the two components");
|
||||||
|
goto end_join_sectors;
|
||||||
|
}
|
||||||
|
|
||||||
|
// displace!
|
||||||
|
for (k=0; k<collnumsects[movestat]; k++)
|
||||||
|
{
|
||||||
|
i = collsectlist[movestat][k];
|
||||||
|
|
||||||
|
sector[i].floorz += dz;
|
||||||
|
sector[i].ceilingz += dz;
|
||||||
|
|
||||||
|
for (WALLS_OF_SECTOR(i, 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;
|
||||||
|
sprite[j].z += dz;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// restore old components
|
||||||
|
highlighted_sectors_components(0);
|
||||||
|
|
||||||
|
} // end if (needsdisp)
|
||||||
|
|
||||||
|
/*** construct the YAX connection! ***/
|
||||||
|
for (comp=0; comp<2; comp++)
|
||||||
|
{
|
||||||
|
// sectors
|
||||||
|
for (k=0; k<collnumsects[comp]; k++)
|
||||||
|
{
|
||||||
|
i = collsectlist[comp][k];
|
||||||
|
yax_setbunch(i, comp^joinstat, numyaxbunches);
|
||||||
|
SECTORFLD(i,stat, comp^joinstat) &= ~1; // no plax
|
||||||
|
|
||||||
|
// restore red walls
|
||||||
|
for (WALLS_OF_SECTOR(i, j))
|
||||||
|
if (wall[j].nextwall < 0)
|
||||||
|
checksectorpointer(j, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// walls
|
||||||
|
for (j=0; j<numowals; j++)
|
||||||
|
yax_setnextwall(outerwall[comp][j], comp^joinstat, outerwall[!comp][j]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bmemset(hlsectorbitmap, 0, sizeof(hlsectorbitmap));
|
||||||
|
update_highlightsector();
|
||||||
|
|
||||||
|
yax_update(0);
|
||||||
|
yax_updategrays(pos.z);
|
||||||
|
|
||||||
|
message("Joined highlighted sectors to new bunch %d", numyaxbunches);
|
||||||
|
asksave = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif // defined YAX_ENABLE
|
#endif // defined YAX_ENABLE
|
||||||
|
@ -6124,7 +6264,7 @@ CANCEL:
|
||||||
// flags:
|
// flags:
|
||||||
// 1: quit_is_yes
|
// 1: quit_is_yes
|
||||||
// 2: don't clear keys on return
|
// 2: don't clear keys on return
|
||||||
static int32_t ask_if_sure(const char *query, uint32_t flags)
|
int32_t ask_if_sure(const char *query, uint32_t flags)
|
||||||
{
|
{
|
||||||
char ch;
|
char ch;
|
||||||
int32_t ret=-1;
|
int32_t ret=-1;
|
||||||
|
@ -6167,7 +6307,7 @@ static int32_t ask_if_sure(const char *query, uint32_t flags)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t editor_ask_function(const char *question, char *dachars, int32_t numchars)
|
int32_t editor_ask_function(const char *question, const char *dachars, int32_t numchars)
|
||||||
{
|
{
|
||||||
char ch;
|
char ch;
|
||||||
int32_t i, ret=-1;
|
int32_t i, ret=-1;
|
||||||
|
|
|
@ -634,19 +634,19 @@ static int yax_cmpbunches(const int16_t *b1, const int16_t *b2)
|
||||||
static void yax_tweakpicnums(int32_t bunchnum, int32_t cf, int32_t restore)
|
static void yax_tweakpicnums(int32_t bunchnum, int32_t cf, int32_t restore)
|
||||||
{
|
{
|
||||||
static int16_t opicnum[2][MAXSECTORS];
|
static int16_t opicnum[2][MAXSECTORS];
|
||||||
int32_t i, stat;
|
int32_t i, dastat;
|
||||||
|
|
||||||
for (SECTORS_OF_BUNCH(bunchnum, cf, i))
|
for (SECTORS_OF_BUNCH(bunchnum, cf, i))
|
||||||
{
|
{
|
||||||
stat = (SECTORFLD(i,stat, cf)&(128+256+4096));
|
dastat = (SECTORFLD(i,stat, cf)&(128+256));
|
||||||
if ((stat&4096) || stat==0)
|
if (dastat==0)
|
||||||
{
|
{
|
||||||
if (!restore)
|
if (!restore)
|
||||||
{
|
{
|
||||||
opicnum[cf][i] = SECTORFLD(i,picnum, cf);
|
opicnum[cf][i] = SECTORFLD(i,picnum, cf);
|
||||||
if (editstatus && showinvisibility)
|
if (editstatus && showinvisibility)
|
||||||
SECTORFLD(i,picnum, cf) = MAXTILES-1-((stat&4096)>>12);
|
SECTORFLD(i,picnum, cf) = MAXTILES-1;
|
||||||
else if ((stat&(128+256))==0)
|
else if ((dastat&(128+256))==0)
|
||||||
SECTORFLD(i,picnum, cf) = 13; //FOF;
|
SECTORFLD(i,picnum, cf) = 13; //FOF;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -7426,7 +7426,7 @@ static void Keys2d(void)
|
||||||
for (i=0; i<numsectors; i++)
|
for (i=0; i<numsectors; i++)
|
||||||
{
|
{
|
||||||
YAX_SKIPSECTOR(i);
|
YAX_SKIPSECTOR(i);
|
||||||
if (inside_editor(&pos, searchx,searchy, zoom, mousxplc,mousyplc,i) == 1)
|
if (inside_editor_curpos(i) == 1)
|
||||||
{
|
{
|
||||||
tcursectornum = i;
|
tcursectornum = i;
|
||||||
break;
|
break;
|
||||||
|
@ -7516,6 +7516,30 @@ static void Keys2d(void)
|
||||||
///__bigcomment__
|
///__bigcomment__
|
||||||
|
|
||||||
#ifdef YAX_ENABLE
|
#ifdef YAX_ENABLE
|
||||||
|
if (eitherCTRL && PRESSED_KEYSC(U) && tcursectornum>=0) // Ctrl-U: unlink bunch sectors
|
||||||
|
{
|
||||||
|
int16_t cf, fb = yax_getbunch(tcursectornum, YAX_FLOOR);
|
||||||
|
if (fb >= 0)
|
||||||
|
{
|
||||||
|
for (SECTORS_OF_BUNCH(fb,YAX_FLOOR, i))
|
||||||
|
fillsector(tcursectornum, editorcolors[11]);
|
||||||
|
fade_editor_screen(editorcolors[11]);
|
||||||
|
|
||||||
|
if (ask_if_sure("Clear all TROR extensions from marked sectors?", 0))
|
||||||
|
{
|
||||||
|
for (cf=0; cf<2; cf++)
|
||||||
|
for (SECTORS_OF_BUNCH(fb,cf, i))
|
||||||
|
yax_setbunch(i, cf, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
yax_update(0);
|
||||||
|
yax_updategrays(pos.z);
|
||||||
|
|
||||||
|
message("Cleared TROR bunch %d", fb);
|
||||||
|
asksave = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (/*!m32_sideview &&*/ numyaxbunches>0)
|
if (/*!m32_sideview &&*/ numyaxbunches>0)
|
||||||
{
|
{
|
||||||
int32_t zsign=0;
|
int32_t zsign=0;
|
||||||
|
@ -7651,7 +7675,7 @@ static void Keys2d(void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i=0; i<numsectors; i++)
|
for (i=0; i<numsectors; i++)
|
||||||
if (inside_editor(&pos, searchx,searchy, zoom, mousxplc,mousyplc,i) == 1)
|
if (inside_editor_curpos(i) == 1)
|
||||||
{
|
{
|
||||||
Bsprintf(buffer,"Sector (%d) Lo-tag: ",i);
|
Bsprintf(buffer,"Sector (%d) Lo-tag: ",i);
|
||||||
// j = qsetmode;
|
// j = qsetmode;
|
||||||
|
@ -7733,7 +7757,7 @@ static void Keys2d(void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i=0; i<numsectors; i++)
|
for (i=0; i<numsectors; i++)
|
||||||
if (inside_editor(&pos, searchx,searchy, zoom, mousxplc,mousyplc,i) == 1)
|
if (inside_editor_curpos(i) == 1)
|
||||||
{
|
{
|
||||||
Bsprintf(tempbuf,"Sector %d Extra: ",i);
|
Bsprintf(tempbuf,"Sector %d Extra: ",i);
|
||||||
sector[i].extra = getnumber16(tempbuf,sector[i].extra,BTAG_MAX,1);
|
sector[i].extra = getnumber16(tempbuf,sector[i].extra,BTAG_MAX,1);
|
||||||
|
@ -7744,7 +7768,7 @@ static void Keys2d(void)
|
||||||
if (!eitherCTRL && PRESSED_KEYSC(E)) // E (expand)
|
if (!eitherCTRL && PRESSED_KEYSC(E)) // E (expand)
|
||||||
{
|
{
|
||||||
for (i=0; i<numsectors; i++)
|
for (i=0; i<numsectors; i++)
|
||||||
if (inside_editor(&pos, searchx,searchy, zoom, mousxplc,mousyplc,i) == 1)
|
if (inside_editor_curpos(i) == 1)
|
||||||
{
|
{
|
||||||
sector[i].floorstat ^= 8;
|
sector[i].floorstat ^= 8;
|
||||||
message("Sector %d floor texture expansion bit %s", i, ONOFF(sector[i].floorstat&8));
|
message("Sector %d floor texture expansion bit %s", i, ONOFF(sector[i].floorstat&8));
|
||||||
|
@ -7765,7 +7789,7 @@ static void Keys2d(void)
|
||||||
else if (graphicsmode != 0)
|
else if (graphicsmode != 0)
|
||||||
{
|
{
|
||||||
for (i=0; i<numsectors; i++)
|
for (i=0; i<numsectors; i++)
|
||||||
if (inside_editor(&pos, searchx,searchy, zoom, mousxplc,mousyplc,i) == 1)
|
if (inside_editor_curpos(i) == 1)
|
||||||
{
|
{
|
||||||
#ifdef YAX_ENABLE
|
#ifdef YAX_ENABLE
|
||||||
if (yax_getbunch(i, YAX_FLOOR) < 0)
|
if (yax_getbunch(i, YAX_FLOOR) < 0)
|
||||||
|
@ -7807,7 +7831,7 @@ static void Keys2d(void)
|
||||||
#ifdef YAX_ENABLE
|
#ifdef YAX_ENABLE
|
||||||
if (k==1 || yax_getbunch(i, YAX_FLOOR) < 0)
|
if (k==1 || yax_getbunch(i, YAX_FLOOR) < 0)
|
||||||
#endif
|
#endif
|
||||||
if (inside_editor(&pos, searchx,searchy, zoom, mousxplc,mousyplc,i) == 1)
|
if (inside_editor_curpos(i) == 1)
|
||||||
{
|
{
|
||||||
uint8_t *panning = (k==0) ? §or[i].floorxpanning : §or[i].floorypanning;
|
uint8_t *panning = (k==0) ? §or[i].floorxpanning : §or[i].floorypanning;
|
||||||
*panning = changechar(*panning, changedir, smooshy, 0);
|
*panning = changechar(*panning, changedir, smooshy, 0);
|
||||||
|
|
Loading…
Reference in a new issue