Set union ['] and difference [;] for sector selection in Mapster32; probably fix for crash on clipshape-init; replace tabs in doc/build*.txt with three spaces.

git-svn-id: https://svn.eduke32.com/eduke32@1728 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2010-11-20 16:47:18 +00:00
parent a633e8baa6
commit 07ecd3eede
7 changed files with 5653 additions and 5584 deletions

View file

@ -122,6 +122,7 @@ extern char lastpm16buf[156];
void getpoint(int32_t searchxe, int32_t searchye, int32_t *x, int32_t *y);
int32_t getpointhighlight(int32_t xplc, int32_t yplc, int32_t point);
void update_highlight();
void update_highlightsector();
#ifdef _WIN32
#define DEFAULT_GAME_EXEC "eduke32.exe"

View file

@ -153,6 +153,7 @@ static int32_t fillist[640];
static int32_t mousx, mousy;
int16_t prefixtiles[16] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
uint8_t hlsectorbitmap[MAXSECTORS>>3]; // show2dsector is already taken...
/*
static char scantoasc[128] =
@ -445,9 +446,7 @@ int32_t app_main(int32_t argc, const char **argv)
}
k = clipmapinfo_load("_clipshape0.map");
if (k==0)
initprintf("Loaded sprite clipping map.\n");
else if (k>0)
if (k>0)
initprintf("There was an error loading the sprite clipping map (status %d).\n", k);
for (i=0; i<MAXSECTORS; i++) sector[i].extra = -1;
@ -1315,6 +1314,7 @@ static void duplicate_selected_sectors()
newnumwalls += sector[highlightsector[i]].wallnum;
}
Bmemset(hlsectorbitmap, 0, sizeof(hlsectorbitmap));
for (i=0; i<highlightsectorcnt; i++)
{
// first, make red lines of old selected sectors, effectively
@ -1330,12 +1330,15 @@ static void duplicate_selected_sectors()
// Then, highlight the ones just copied.
// These will have all walls whited out.
highlightsector[i] = numsectors+i;
j = numsectors + i;
hlsectorbitmap[j>>3] |= (1<<(j&7));
}
numsectors = newnumsectors;
numwalls = newnumwalls;
update_highlightsector(); // must be after numsectors = newnumsectors
newnumwalls = -1;
newnumsectors = -1;
@ -1396,6 +1399,19 @@ void update_highlight()
highlightcnt = -1;
}
void update_highlightsector()
{
int32_t i;
highlightsectorcnt = 0;
for (i=0; i<numsectors; i++)
if (hlsectorbitmap[i>>3]&(1<<(i&7)))
highlightsector[highlightsectorcnt++] = i;
if (highlightsectorcnt==0)
highlightsectorcnt = -1;
}
void overheadeditor(void)
{
char buffer[80], *dabuffer, ch;
@ -1448,12 +1464,12 @@ void overheadeditor(void)
enddrawing(); //}}}
pag = 0;
highlightcnt = -1;
cursectorhighlight = -1;
lastpm16time = -1;
ovh_whiteoutgrab();
highlightcnt = -1;
Bmemset(show2dwall, 0, sizeof(show2dwall)); //Clear all highlights
Bmemset(show2dsprite, 0, sizeof(show2dsprite));
@ -1777,9 +1793,10 @@ void overheadeditor(void)
numwalls = tempint;
if (highlightsectorcnt > 0)
for (i=0; i<highlightsectorcnt; i++)
fillsector(highlightsector[i],2);
if (highlightsectorcnt >= 0)
for (i=0; i<numsectors; i++)
if (hlsectorbitmap[i>>3]&(1<<(i&7)))
fillsector(i,2);
if (keystatus[0x2a]) // FIXME
{
@ -1809,7 +1826,7 @@ void overheadeditor(void)
if (joinsector[0] >= 0)
col = editorcolors[11];
if (keystatus[0x36] && !eitherCTRL) // RSHIFT
if ((keystatus[0x36] || keystatus[0xb8]) && !eitherCTRL) // RSHIFT || RALT
{
if (keystatus[0x27] || keystatus[0x28]) // ' and ;
{
@ -2486,6 +2503,8 @@ void overheadeditor(void)
{
if (highlightsectorcnt == 0)
{
int32_t add=keystatus[0x28], sub=(!add && keystatus[0x27]), setop=(add||sub);
getpoint(highlightx1,highlighty1, &highlightx1,&highlighty1);
getpoint(highlightx2,highlighty2, &highlightx2,&highlighty2);
@ -2494,6 +2513,9 @@ void overheadeditor(void)
if (highlighty1 > highlighty2)
swaplong(&highlighty1, &highlighty2);
if (!setop)
Bmemset(hlsectorbitmap, 0, sizeof(hlsectorbitmap));
for (i=0; i<numsectors; i++)
{
startwall = sector[i].wallptr;
@ -2508,11 +2530,23 @@ void overheadeditor(void)
if (bad == 1) break;
}
if (bad == 0)
highlightsector[highlightsectorcnt++] = i;
{
if (sub)
{
hlsectorbitmap[i>>3] &= ~(1<<(i&7));
for (j=sector[i].wallptr; j<sector[i].wallptr+sector[i].wallnum; j++)
{
if (wall[j].nextwall >= 0)
checksectorpointer(wall[j].nextwall,wall[j].nextsector);
checksectorpointer((int16_t)j, i);
}
}
else
hlsectorbitmap[i>>3] |= (1<<(i&7));
}
}
if (highlightsectorcnt <= 0)
highlightsectorcnt = -1;
update_highlightsector();
ovh_whiteoutgrab();
}
}
@ -3997,6 +4031,7 @@ SKIP:
}
newnumwalls = -1;
Bmemset(hlsectorbitmap, 0, sizeof(hlsectorbitmap));
highlightsectorcnt = -1;
Bmemset(show2dwall, 0, sizeof(show2dwall));
@ -4009,6 +4044,7 @@ SKIP:
if (k == 0)
{
deletesector((int16_t)i);
Bmemset(hlsectorbitmap, 0, sizeof(hlsectorbitmap));
highlightsectorcnt = -1;
Bmemset(show2dwall, 0, sizeof(show2dwall));
@ -4149,6 +4185,9 @@ nextmap:
Bstrcpy(boardfilename, selectedboardfilename);
highlightcnt = -1;
Bmemset(show2dwall, 0, sizeof(show2dwall)); //Clear all highlights
Bmemset(show2dsprite, 0, sizeof(show2dsprite));
sectorhighlightstat = -1;
newnumwalls = -1;
joinsector[0] = -1;
@ -4242,9 +4281,10 @@ CANCEL:
if (ch == 'Y' || ch == 'y')
{
Bmemset(hlsectorbitmap, 0, sizeof(hlsectorbitmap));
highlightsectorcnt = -1;
highlightcnt = -1;
highlightcnt = -1;
//Clear all highlights
Bmemset(show2dwall, 0, sizeof(show2dwall));
Bmemset(show2dsprite, 0, sizeof(show2dsprite));
@ -4311,6 +4351,7 @@ CANCEL:
updatenumsprites();
if ((numsectors+highlightsectorcnt > MAXSECTORS) || (numwalls+j > MAXWALLS) || (numsprites+k > MAXSPRITES))
{
Bmemset(hlsectorbitmap, 0, sizeof(hlsectorbitmap));
highlightsectorcnt = -1;
}
else
@ -4353,6 +4394,9 @@ CANCEL:
}
highlightcnt = -1;
Bmemset(show2dwall, 0, sizeof(show2dwall)); //Clear all highlights
Bmemset(show2dsprite, 0, sizeof(show2dsprite));
sectorhighlightstat = -1;
newnumwalls = -1;
joinsector[0] = -1;
@ -4380,18 +4424,22 @@ CANCEL:
{
if ((numsectors+highlightsectorcnt > MAXSECTORS) || (sector[MAXSECTORS-highlightsectorcnt].wallptr < numwalls))
{
Bmemset(hlsectorbitmap, 0, sizeof(hlsectorbitmap));
highlightsectorcnt = -1;
}
else
{
//Re-attach sectors&walls
Bmemset(hlsectorbitmap, 0, sizeof(hlsectorbitmap));
for (i=0; i<highlightsectorcnt; i++)
{
copysector((int16_t)(MAXSECTORS-highlightsectorcnt+i),numsectors,numwalls,0);
highlightsector[i] = numsectors;
hlsectorbitmap[numsectors>>3] |= (1<<(numsectors&7));
numwalls += sector[numsectors].wallnum;
numsectors++;
}
update_highlightsector();
//Re-attach sprites
while (m < MAXSPRITES)
{

View file

@ -264,14 +264,19 @@ static void clipmapinfo_init()
clipmapinfo.numsectors = clipmapinfo.numwalls = 0;
clipmapinfo.sector=NULL;
clipmapinfo.wall=NULL;
numsectors = 0;
numwalls = 0;
}
// loads the clip maps 0 through 9.
// this should be called before any real map is loaded.
int32_t clipmapinfo_load(char *filename)
{
int32_t i,k,w, px,py,pz;
int16_t ang,cs;
char fn[BMAX_PATH];
char fn[BMAX_PATH], loadedwhich[32]={0}, *lwcp=loadedwhich;
int32_t slen, fi, fisec[10], fispr[10];
int32_t ournumsectors=0, ournumwalls=0, ournumsprites=0, numsprites;
@ -337,6 +342,14 @@ int32_t clipmapinfo_load(char *filename)
ournumsectors += numsectors;
ournumwalls += numwalls;
ournumsprites += numsprites;
if (lwcp != loadedwhich)
{
*lwcp++ = ',';
*lwcp++ = ' ';
}
*lwcp++ = fi;
*lwcp = 0;
}
quickloadboard = 0;
@ -346,6 +359,7 @@ int32_t clipmapinfo_load(char *filename)
return -1;
}
// shrink
loadsector = Brealloc(loadsector, ournumsectors*sizeof(sectortype));
loadwall = Brealloc(loadwall, ournumwalls*sizeof(walltype));
@ -621,6 +635,12 @@ int32_t clipmapinfo_load(char *filename)
Bfree(loadsprite); loadsprite=NULL;
Bfree(tempictoidx); tempictoidx=NULL;
// don't let other code be distracted by the temporary map we constructed
numsectors = 0;
numwalls = 0;
initprintf("Loaded clip map%s %s.\n", lwcp==loadedwhich+1?"":"s", loadedwhich);
return 0;
}
@ -7162,6 +7182,7 @@ int32_t loadboard(char *filename, char fromwhere, int32_t *daposx, int32_t *dapo
{
initprintf(OSD_ERROR "Map error: sprite #%d(%d,%d) with illegal picnum(%d). Map is corrupt!\n",i,sprite[i].x,sprite[i].y,sprite[i].picnum);
dq[dnum++] = i;
sprite[i].picnum = 0;
}
}
@ -9491,7 +9512,7 @@ int32_t lastwall(int16_t point)
//////////
static int32_t clipsprite_try(spritetype *spr, int32_t xmin, int32_t ymin, int32_t xmax, int32_t ymax)
static int32_t clipsprite_try(const spritetype *spr, int32_t xmin, int32_t ymin, int32_t xmax, int32_t ymax)
{
int32_t i,k,tempint1,tempint2;
@ -9969,7 +9990,8 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
do
{
intx = goalx; inty = goaly;
if ((hitwall = raytrace(vect->x, vect->y, &intx, &inty)) >= 0)
hitwall = raytrace(vect->x, vect->y, &intx, &inty);
if (hitwall >= 0)
{
lx = clipit[hitwall].x2-clipit[hitwall].x1;
ly = clipit[hitwall].y2-clipit[hitwall].y1;
@ -12148,7 +12170,7 @@ void draw2dscreen(int32_t posxe, int32_t posye, int16_t ange, int32_t zoome, int
if (totalclock & 16)
pointsize++;
}
else if ((highlightcnt > 0) && (editstatus == 1))
else //if (highlightcnt > 0)
{
if (show2dwall[i>>3]&pow2char[i&7])
{
@ -12193,7 +12215,7 @@ void draw2dscreen(int32_t posxe, int32_t posye, int16_t ange, int32_t zoome, int
{
if (totalclock & 32) col += (2<<2);
}
else if ((highlightcnt > 0) && (editstatus == 1))
else // if (highlightcnt > 0)
{
if (show2dsprite[j>>3]&pow2char[j&7])
if (totalclock & 32) col += (2<<2);

View file

@ -9860,9 +9860,7 @@ CLEAN_DIRECTORY:
}
i = clipmapinfo_load("_clipshape0.map");
if (i==0)
initprintf("Loaded sprite clipping map.\n");
else if (i>0)
if (i>0)
initprintf("There was an error loading the sprite clipping map (status %d).\n", i);
OSD_Exec("autoexec.cfg");