mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 09:21:36 +00:00
When joining sectors and there's more than one non-grayed-out sector under the
cursor, query the mapper to pick one. The joining can still fail afterwards, which makes it only a semi-automatic helper feature. git-svn-id: https://svn.eduke32.com/eduke32@2092 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
51b31c5445
commit
4d40d32014
1 changed files with 72 additions and 32 deletions
|
@ -2538,6 +2538,32 @@ static int32_t find_nextwall(int32_t sectnum, int32_t sectnum2)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t bakframe_fillandfade(char **origframeptr, int32_t sectnum, const char *querystr)
|
||||||
|
{
|
||||||
|
if (!*origframeptr)
|
||||||
|
{
|
||||||
|
*origframeptr = Bmalloc(xdim*ydim);
|
||||||
|
if (*origframeptr)
|
||||||
|
{
|
||||||
|
begindrawing();
|
||||||
|
Bmemcpy(*origframeptr, (char *)frameplace, xdim*ydim);
|
||||||
|
enddrawing();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
begindrawing();
|
||||||
|
Bmemcpy((char *)frameplace, *origframeptr, xdim*ydim);
|
||||||
|
enddrawing();
|
||||||
|
}
|
||||||
|
|
||||||
|
fillsector(sectnum, editorcolors[9]);
|
||||||
|
fade_editor_screen(editorcolors[9]);
|
||||||
|
|
||||||
|
return ask_if_sure(querystr, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void overheadeditor(void)
|
void overheadeditor(void)
|
||||||
{
|
{
|
||||||
char buffer[80];
|
char buffer[80];
|
||||||
|
@ -5021,18 +5047,34 @@ end_point_dragging:
|
||||||
#endif // defined YAX_ENABLE
|
#endif // defined YAX_ENABLE
|
||||||
if (joinsector[0] < 0)
|
if (joinsector[0] < 0)
|
||||||
{
|
{
|
||||||
joinsector[0] = -1;
|
int32_t numjoincandidates = 0;
|
||||||
|
char *origframe=NULL;
|
||||||
|
|
||||||
|
for (i=0; i<numsectors; i++)
|
||||||
|
{
|
||||||
|
YAX_SKIPSECTOR(i);
|
||||||
|
numjoincandidates += (inside_editor_curpos(i) == 1);
|
||||||
|
}
|
||||||
|
|
||||||
for (i=0; i<numsectors; i++)
|
for (i=0; i<numsectors; i++)
|
||||||
{
|
{
|
||||||
YAX_SKIPSECTOR(i);
|
YAX_SKIPSECTOR(i);
|
||||||
if (inside_editor_curpos(i) == 1)
|
if (inside_editor_curpos(i) == 1)
|
||||||
{
|
{
|
||||||
|
if (numjoincandidates > 1)
|
||||||
|
{
|
||||||
|
if (!bakframe_fillandfade(&origframe, i, "Use this as first joining sector? (Y/N)"))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
joinsector[0] = i;
|
joinsector[0] = i;
|
||||||
printmessage16("Join sector - press J again on sector to join with.");
|
printmessage16("Join sector - press J again on sector to join with.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
goto end_join_sectors;
|
|
||||||
|
if (origframe)
|
||||||
|
Bfree(origframe);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -5041,14 +5083,29 @@ end_point_dragging:
|
||||||
int16_t jbn[2][2]; // [join index][c/f]
|
int16_t jbn[2][2]; // [join index][c/f]
|
||||||
int32_t uneqbn; // unequal bunchnums (bitmap): 1:above, 2:below
|
int32_t uneqbn; // unequal bunchnums (bitmap): 1:above, 2:below
|
||||||
#endif
|
#endif
|
||||||
|
char *origframe = NULL;
|
||||||
|
int32_t numjoincandidates = 0;
|
||||||
|
|
||||||
joinsector[1] = -1;
|
joinsector[1] = -1;
|
||||||
|
|
||||||
|
for (i=0; i<numsectors; i++)
|
||||||
|
{
|
||||||
|
YAX_SKIPSECTOR(i);
|
||||||
|
numjoincandidates += (inside_editor_curpos(i) == 1);
|
||||||
|
}
|
||||||
|
|
||||||
for (i=0; i<numsectors; i++)
|
for (i=0; i<numsectors; i++)
|
||||||
{
|
{
|
||||||
YAX_SKIPSECTOR(i);
|
YAX_SKIPSECTOR(i);
|
||||||
|
|
||||||
if (inside_editor_curpos(i) == 1)
|
if (inside_editor_curpos(i) == 1)
|
||||||
{
|
{
|
||||||
|
if (numjoincandidates > 1)
|
||||||
|
{
|
||||||
|
if (!bakframe_fillandfade(&origframe, i, "Use this as second joining sector? (Y/N)"))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
s1to0wall = find_nextwall(i, joinsector[0]);
|
s1to0wall = find_nextwall(i, joinsector[0]);
|
||||||
s0to1wall = wall[s1to0wall].nextwall;
|
s0to1wall = wall[s1to0wall].nextwall;
|
||||||
joinsector[1] = i;
|
joinsector[1] = i;
|
||||||
|
@ -5123,7 +5180,8 @@ end_point_dragging:
|
||||||
|
|
||||||
if ((uneqbn&2)==0)
|
if ((uneqbn&2)==0)
|
||||||
{
|
{
|
||||||
if (0) //(whybad==1+8 && jbn[0][cf]>=0 && jbn[1][cf]<0)
|
#if 0
|
||||||
|
if (whybad==1+8 && jbn[0][cf]>=0 && jbn[1][cf]<0)
|
||||||
{
|
{
|
||||||
// 1st join sector extended, 2nd not... let's see
|
// 1st join sector extended, 2nd not... let's see
|
||||||
// if the latter is inner to the former one
|
// if the latter is inner to the former one
|
||||||
|
@ -5164,6 +5222,7 @@ end_point_dragging:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (whybad&1)
|
if (whybad&1)
|
||||||
message("Can't make floor bunchnums equal: both floors must be extended");
|
message("Can't make floor bunchnums equal: both floors must be extended");
|
||||||
|
@ -5358,9 +5417,11 @@ end_point_dragging:
|
||||||
}
|
}
|
||||||
|
|
||||||
joinsector[0] = -1;
|
joinsector[0] = -1;
|
||||||
|
end_join_sectors:
|
||||||
|
if (origframe)
|
||||||
|
Bfree(origframe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end_join_sectors:
|
|
||||||
|
|
||||||
// PK
|
// PK
|
||||||
for (i=0x02; i<=0x0b; i++) // keys '1' to '0' on the upper row
|
for (i=0x02; i<=0x0b; i++) // keys '1' to '0' on the upper row
|
||||||
|
@ -6269,7 +6330,7 @@ end_space_handling:
|
||||||
|
|
||||||
if (keystatus[0xd3] && eitherCTRL && numwalls > 0) //sector delete
|
if (keystatus[0xd3] && eitherCTRL && numwalls > 0) //sector delete
|
||||||
{
|
{
|
||||||
int32_t numdelsectors = 0, didbak=0;
|
int32_t numdelsectors = 0;
|
||||||
char *origframe=NULL;
|
char *origframe=NULL;
|
||||||
|
|
||||||
#ifdef YAX_ENABLE
|
#ifdef YAX_ENABLE
|
||||||
|
@ -6324,28 +6385,7 @@ end_space_handling:
|
||||||
{
|
{
|
||||||
if (numdelsectors > 1)
|
if (numdelsectors > 1)
|
||||||
{
|
{
|
||||||
if (!didbak)
|
if (!bakframe_fillandfade(&origframe, i, "Delete this sector? (Y/N)"))
|
||||||
{
|
|
||||||
origframe = Bmalloc(xdim*ydim);
|
|
||||||
if (origframe)
|
|
||||||
{
|
|
||||||
begindrawing();
|
|
||||||
Bmemcpy(origframe, (char *)frameplace, xdim*ydim);
|
|
||||||
enddrawing();
|
|
||||||
didbak = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
begindrawing();
|
|
||||||
Bmemcpy((char *)frameplace, origframe, xdim*ydim);
|
|
||||||
enddrawing();
|
|
||||||
}
|
|
||||||
|
|
||||||
fillsector(i, editorcolors[9]);
|
|
||||||
fade_editor_screen(editorcolors[9]);
|
|
||||||
|
|
||||||
if (!ask_if_sure("Delete this sector? (Y/N)", 0))
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue