New sector selection mode in 2d mode: if RCtrl is pressed when releasing RAlt, then instead of the sector having to be contained in the rectangle, the mouse pointer must be inside a sector to be selected. This way it's easy to select sectors with arbitrary shapes. Set ops work independently of it, too. Also some annoyance fixes with sprite movement.

git-svn-id: https://svn.eduke32.com/eduke32@1816 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-03-02 21:21:47 +00:00
parent 0c9618bc44
commit 0fbd035e54
4 changed files with 360 additions and 164 deletions

View file

@ -61,6 +61,17 @@ extern "C" {
#define PR_LIGHT_PRIO_LOW 4
#define PR_LIGHT_PRIO_LOW_GAME 5
////////// yax defs //////////
#define YAX_BIT 1024
#define YAX_CEILING 0
#define YAX_FLOOR 1
#define YAX_SECTORFLD(Sect,Fld, Cf) (*((uint8_t *)&sector[Sect].ceiling##Fld + (Cf)*((char*)&sector[0].floor##Fld - (char*)&sector[0].ceiling##Fld)))
int16_t yax_getbunch(int16_t i, int16_t cf);
void yax_setbunch(int16_t i, int16_t cf, int16_t bunchnum);
#define CLIPMASK0 (((1L)<<16)+1L)
#define CLIPMASK1 (((256L)<<16)+64L)
@ -577,6 +588,8 @@ int32_t changespritesect(int16_t spritenum, int16_t newsectnum);
int32_t changespritestat(int16_t spritenum, int16_t newstatnum);
int32_t setsprite(int16_t spritenum, const vec3_t *new) ATTRIBUTE((nonnull(2)));
int32_t spriteheight(int16_t i, int32_t *basez);
int32_t screencapture(const char *filename, char inverseit) ATTRIBUTE((nonnull(1)));
int32_t getclosestcol(int32_t r, int32_t g, int32_t b);

View file

@ -1110,13 +1110,15 @@ void editinput(void)
cz = getceilzofslope(hitinfo.hitsect, hitinfo.pos.x, hitinfo.pos.y);
fz = getflorzofslope(hitinfo.hitsect, hitinfo.pos.x, hitinfo.pos.y);
j = (tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<1;
j = spriteheight(i, NULL)>>1;
sprite[i].z = hitinfo.pos.z;
if ((sprite[i].cstat&128) == 0)
bclamp(&sprite[i].z, cz+(j<<1), fz);
else
bclamp(&sprite[i].z, cz+j, fz-j);
if ((sprite[i].cstat&48)!=32)
{
if ((sprite[i].cstat&128) == 0)
bclamp(&sprite[i].z, cz+(j<<1), fz);
else
bclamp(&sprite[i].z, cz+j, fz-j);
}
if (searchstat == 0 || searchstat == 4)
{
@ -1796,21 +1798,106 @@ static int32_t copyloop1(int16_t *danumwalls, int32_t *m)
return 0;
}
static void updatesprite1(int16_t j)
static void updatesprite1(int16_t i)
{
int32_t tempint;
setsprite(i, (vec3_t *)&sprite[i]);
setsprite(j, (vec3_t *)&sprite[j]);
tempint = (tilesizy[sprite[j].picnum]*sprite[j].yrepeat)<<2;
if (sprite[j].sectnum>=0)
if ((sprite[i].cstat&48)!=32 && sprite[i].sectnum>=0)
{
sprite[j].z = max(sprite[j].z, getceilzofslope(sprite[j].sectnum,sprite[j].x,sprite[j].y)+tempint);
sprite[j].z = min(sprite[j].z, getflorzofslope(sprite[j].sectnum,sprite[j].x,sprite[j].y));
int32_t tempint, cz, fz;
tempint = spriteheight(i, NULL);
if (sprite[i].cstat&128)
tempint >>= 1;
cz = getceilzofslope(sprite[i].sectnum, sprite[i].x,sprite[i].y);
fz = getflorzofslope(sprite[i].sectnum, sprite[i].x,sprite[i].y);
sprite[i].z = max(sprite[i].z, cz+tempint);
sprite[i].z = min(sprite[i].z, fz);
}
}
static int32_t ask_if_sure(const char *query, uint32_t flags);
static int32_t ask_above_or_below();
// returns:
// 0: continue
// >0: newnumwalls
// <0: error
static int32_t trace_loop(int32_t j, uint8_t *visitedwall, int16_t *ignore_ret, int16_t *refsect_ret)
{
int16_t refsect, ignore;
int32_t k, n, refwall;
if (wall[j].nextwall>=0 || (visitedwall[j>>3]&(1<<(j&7))))
return 0;
n=2*MAXWALLS; // simple inf loop check
refwall = j;
k = numwalls;
ignore = 0;
if (ignore_ret)
{
refsect = -1;
updatesectorexclude(wall[j].x, wall[j].y, &refsect, hlsectorbitmap);
if (refsect<0)
return -1;
}
do
{
if (j!=refwall && visitedwall[j>>3]&(1<<(j&7)))
ignore = 1;
visitedwall[j>>3] |= (1<<(j&7));
if (ignore_ret)
{
if (inside(wall[j].x, wall[j].y, refsect) != 1)
ignore = 1;
}
if (!ignore)
{
if (k>=MAXWALLS)
{
message("Wall limits exceeded while tracing outer loop.");
return -2;
}
Bmemcpy(&wall[k], &wall[j], sizeof(walltype));
wall[k].point2 = k+1;
wall[k].nextsector = wall[k].nextwall = wall[k].extra = -1;
k++;
}
j = wall[j].point2;
n--;
while (wall[j].nextwall>=0 && n>0)
{
j = wall[wall[j].nextwall].point2;
// if (j!=refwall && (visitedwall[j>>3]&(1<<(j&7))))
// ignore = 1;
// visitedwall[j>>3] |= (1<<(j&7));
n--;
}
}
while (j!=refwall && n>0);
if (j!=refwall)
{
message("internal error while tracing outer loop: didn't reach refwall");
return -3;
}
if (ignore_ret)
*ignore_ret = ignore;
if (refsect_ret)
*refsect_ret = refsect;
return k;
}
void overheadeditor(void)
{
@ -2224,7 +2311,7 @@ void overheadeditor(void)
printext16(8,8, editorcolors[13],editorcolors[0],cbuf,0);
}
if ((keystatus[0x36] || keystatus[0xb8]) && !eitherCTRL) // RSHIFT || RALT
if (keystatus[0x36] || keystatus[0xb8]) // RSHIFT || RALT
{
if (keystatus[0x27] || keystatus[0x28]) // ' and ;
{
@ -2252,10 +2339,8 @@ void overheadeditor(void)
x2 = mulscale14(dax-pos.x,zoom);
y2 = mulscale14(day-pos.y,zoom);
if (wall[linehighlight].nextsector >= 0)
drawline16base(halfxdim16+x2,midydim16+y2, 0,0, 0,0, editorcolors[15]);
else
drawline16base(halfxdim16+x2,midydim16+y2, 0,0, 0,0, editorcolors[5]);
drawline16base(halfxdim16+x2,midydim16+y2, 0,0, 0,0,
wall[linehighlight].nextsector >= 0 ? editorcolors[15] : editorcolors[5]);
}
enddrawing(); //}}}
@ -2676,15 +2761,49 @@ void overheadeditor(void)
{
keystatus[0x12] = 0;
if (pointhighlight >= 16384)
if (!eitherCTRL)
{
i = pointhighlight-16384;
Bsprintf(buffer, "Sprite (%d) Status list: ", i);
changespritestat(i, getnumber16(buffer, sprite[i].statnum, 65535, 0));
if (pointhighlight >= 16384)
{
i = pointhighlight-16384;
Bsprintf(buffer, "Sprite (%d) Status list: ", i);
changespritestat(i, getnumber16(buffer, sprite[i].statnum, MAXSTATUS-1, 0));
// clearmidstatbar16();
// showspritedata((int16_t)i);
// printmessage16("");
}
}
else if (highlightsectorcnt > 0&&0)
{
////////// YAX //////////
static const char *cfs[2] = {"ceiling", "floor"};
int32_t cf, good, thez;
cf = ask_above_or_below();
if (!cf)
goto end_yax;
cf--;
good = (highlightsectorcnt==1 || (YAX_SECTORFLD(highlightsector[0],stat, cf)&2)==0);
thez = YAX_SECTORFLD(highlightsector[0],z, cf);
for (i=1; i<highlightsectorcnt; i++)
{
if (YAX_SECTORFLD(highlightsector[i],z, cf) != thez)
{
message("All sectors must have the same %s height", cfs[cf]);
goto end_yax;
}
if ((YAX_SECTORFLD(highlightsector[i],stat, cf)&2)!=0)
{
message("Sector %ss must not be sloped", cfs[cf]);
goto end_yax;
}
}
end_yax: ;
}
// printmessage16("");
}
if (highlightsectorcnt < 0)
@ -2724,12 +2843,13 @@ void overheadeditor(void)
if (highlighty1 > highlighty2)
swaplong(&highlighty1, &highlighty2);
// Ctrl+RShift: select all wall-points of highlighted wall's loop:
if (eitherCTRL)
{
Bmemset(show2dwall, 0, sizeof(show2dwall));
Bmemset(show2dsprite, 0, sizeof(show2dsprite));
if ((linehighlight >= 0) && (linehighlight < MAXWALLS))
if (linehighlight >= 0 && linehighlight < MAXWALLS)
{
i = linehighlight;
do
@ -2793,14 +2913,17 @@ void overheadeditor(void)
{
if (highlightsectorcnt == 0)
{
int32_t xx[] = { highlightx1, highlightx1, searchx, searchx, highlightx1 };
int32_t yy[] = { highlighty1, searchy, searchy, highlighty1, highlighty1 };
if (!eitherCTRL)
{
int32_t xx[] = { highlightx1, highlightx1, searchx, searchx, highlightx1 };
int32_t yy[] = { highlighty1, searchy, searchy, highlighty1, highlighty1 };
highlightx2 = searchx;
highlighty2 = searchy;
ydim16 = ydim-STATUS2DSIZ2;
highlightx2 = searchx;
highlighty2 = searchy;
ydim16 = ydim-STATUS2DSIZ2;
plotlines2d(xx, yy, 5, editorcolors[10]);
plotlines2d(xx, yy, 5, editorcolors[10]);
}
}
else
{
@ -2833,84 +2956,28 @@ void overheadeditor(void)
clearkeys();
}
while (!didmakered && !hadouterpoint && newnumwalls<0) // if
if (!didmakered && !hadouterpoint && newnumwalls<0)
{
int32_t tmpnumwalls=0, refwall;
uint8_t *visitedwall = Bcalloc((numwalls+7)>>3,1);
int16_t ignore, refsect;
int32_t n;
if (!visitedwall)
{
message("out of memory!");
break;
goto outtathis;
}
for (i=0; i<highlightsectorcnt; i++)
tmpnumwalls += sector[highlightsector[i]].wallnum;
for (i=0; i<highlightsectorcnt; i++)
{
for (WALLS_OF_SECTOR(highlightsector[i], j))
{
int16_t refsect, ignore;
int32_t n;
if (wall[j].nextwall>=0 || (visitedwall[j>>3]&(1<<(j&7))))
k = trace_loop(j, visitedwall, &ignore, &refsect);
if (k == 0)
continue;
n=2*tmpnumwalls; // simple inf loop check
refwall = j;
k = numwalls;
ignore = 0;
refsect = -1;
updatesectorexclude(wall[j].x, wall[j].y, &refsect, hlsectorbitmap);
if (refsect<0)
else if (k < 0)
goto outtathis;
do
{
if (j!=refwall && visitedwall[j>>3]&(1<<(j&7)))
ignore = 1;
visitedwall[j>>3] |= (1<<(j&7));
if (inside(wall[j].x, wall[j].y, refsect)!=1)
ignore = 1;
if (!ignore)
{
if (k>=MAXWALLS)
{
message("Wall limits exceeded while tracing outer loop.");
goto outtathis;
}
Bmemcpy(&wall[k], &wall[j], sizeof(walltype));
wall[k].point2 = k+1;
wall[k].nextsector = wall[k].nextwall = wall[k].extra = -1;
k++;
}
j = wall[j].point2;
n--;
while (wall[j].nextwall>=0 && n>0)
{
j = wall[wall[j].nextwall].point2;
// if (j!=refwall && (visitedwall[j>>3]&(1<<(j&7))))
// ignore = 1;
// visitedwall[j>>3] |= (1<<(j&7));
n--;
}
}
while (j!=refwall && n>0);
if (j!=refwall)
{
message("internal error while tracing outer loop: didn't reach refwall");
goto outtathis;
}
if (!ignore)
{
wall[k-1].point2 = numwalls; // close the loop
@ -2967,15 +3034,14 @@ void overheadeditor(void)
}
outtathis:
newnumwalls = -1;
Bfree(visitedwall);
break; // --|
} // <---------/
if (visitedwall)
Bfree(visitedwall);
}
highlightx1 = searchx;
highlighty1 = searchy;
highlightx2 = searchx;
highlighty2 = searchx;
highlighty2 = searchy;
highlightsectorcnt = 0;
}
}
@ -2984,29 +3050,41 @@ outtathis:
if (highlightsectorcnt == 0)
{
int32_t add=keystatus[0x28], sub=(!add && keystatus[0x27]), setop=(add||sub);
int32_t pointsel = eitherCTRL;
getpoint(highlightx1,highlighty1, &highlightx1,&highlighty1);
getpoint(highlightx2,highlighty2, &highlightx2,&highlighty2);
if (highlightx1 > highlightx2)
swaplong(&highlightx1, &highlightx2);
if (highlighty1 > highlighty2)
swaplong(&highlighty1, &highlighty2);
if (!pointsel)
{
if (highlightx1 > highlightx2)
swaplong(&highlightx1, &highlightx2);
if (highlighty1 > highlighty2)
swaplong(&highlighty1, &highlighty2);
}
if (!setop)
Bmemset(hlsectorbitmap, 0, sizeof(hlsectorbitmap));
for (i=0; i<numsectors; i++)
{
bad = 0;
for (WALLS_OF_SECTOR(i, j))
if (pointsel)
{
if (wall[j].x < highlightx1) bad = 1;
if (wall[j].x > highlightx2) bad = 1;
if (wall[j].y < highlighty1) bad = 1;
if (wall[j].y > highlighty2) bad = 1;
if (bad == 1) break;
bad = (inside(highlightx2, highlighty2, i)!=1);
}
else
{
bad = 0;
for (WALLS_OF_SECTOR(i, j))
{
if (wall[j].x < highlightx1) bad = 1;
if (wall[j].x > highlightx2) bad = 1;
if (wall[j].y < highlighty1) bad = 1;
if (wall[j].y > highlighty2) bad = 1;
if (bad == 1) break;
}
}
if (bad == 0)
{
if (sub)
@ -3026,6 +3104,9 @@ outtathis:
update_highlightsector();
ovh_whiteoutgrab();
if (highlightsectorcnt>0)
printmessage16("Total selected sectors: %d", highlightsectorcnt);
}
}
}
@ -3145,7 +3226,7 @@ end_after_dragging:
break;
}
if ((cursectorhighlight >= 0) && (cursectorhighlight < numsectors))
if (cursectorhighlight >= 0 && cursectorhighlight < numsectors)
{
// for (i=0; i<highlightsectorcnt; i++)
// if (cursectorhighlight == highlightsector[i])
@ -3200,7 +3281,7 @@ end_after_dragging:
}
}
else
else //if (highlightsectorcnt <= 0)
{
if ((bstatus&1) > (oldmousebstatus&1))
pointhighlight = getpointhighlight(mousxplc, mousyplc, pointhighlight);
@ -3286,7 +3367,7 @@ end_after_dragging:
if (setsprite(daspr, &vec) == -1 && osec>=0)
Bmemcpy(&sprite[daspr], &ovec, sizeof(vec3_t));
#if 0
daz = ((tilesizy[sprite[daspr].picnum]*sprite[daspr].yrepeat)<<2);
daz = spriteheight(daspr, NULL);
for (i=0; i<numsectors; i++)
if (inside(dax,day,i) == 1)
@ -3414,7 +3495,7 @@ end_point_dragging:
else
{
m32_sideview = !m32_sideview;
message("Side view %s", m32_sideview?"enabled":"disabled");
printmessage16("Side view %s", m32_sideview?"enabled":"disabled");
m32_setkeyfilter(1);
}
@ -3673,6 +3754,7 @@ end_point_dragging:
deletesector(joinsector[1]);
printmessage16("Sectors joined.");
asksave = 1;
}
joinsector[0] = -1;
@ -3747,8 +3829,9 @@ end_join_sectors:
else
{
sprite[i].z = getflorzofslope(sucksect,dax,day);
if ((sprite[i].cstat&128) != 0)
sprite[i].z -= ((tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<1);
// if (sprite[i].cstat&128)
// sprite[i].z -= spriteheight(i, NULL)>>1;
// PK
if (prefixarg)
{
@ -5044,6 +5127,35 @@ static int32_t ask_if_sure(const char *query, uint32_t flags)
return 0;
}
static int32_t ask_above_or_below()
{
char ch;
int32_t ret=0;
_printmessage16("Extend above (a) or below (z)?");
showframe(1);
bflushchars();
while ((keystatus[1]|keystatus[0x2e]) == 0 && ret==0)
{
if (handleevents())
quitevent = 0;
idle();
ch = bgetchar();
if (ch == 'a' || ch == 'A')
ret = 1;
else if (ch == 'z' || ch == 'Z')
ret = 2;
}
clearkeys();
return ret;
}
// flags: 1:no ExSaveMap (backup.map)
const char *SaveBoard(const char *fn, uint32_t flags)
{
@ -5527,7 +5639,7 @@ void fixspritesectors(void)
if (inside(dax,day,sprite[i].sectnum) != 1)
{
daz = (tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<2;
daz = spriteheight(i, NULL);
for (j=0; j<numsectors; j++)
if (inside(dax,day, j) == 1
@ -6326,12 +6438,11 @@ int32_t fillsector(int16_t sectnum, char fillcolor)
endwall = startwall + sector[sectnum].wallnum - 1;
for (z=startwall; z<=endwall; z++)
{
y1 = (((wall[z].y-pos.y)*zoom)>>14)+midydim16;
y2 = (((POINT2(z).y-pos.y)*zoom)>>14)+midydim16;
if (y1 < miny) miny = y1;
if (y2 < miny) miny = y2;
if (y1 > maxy) maxy = y1;
if (y2 > maxy) maxy = y2;
y1 = midydim16 + (((wall[z].y-pos.y)*zoom)>>14);
y2 = midydim16 + (((POINT2(z).y-pos.y)*zoom)>>14);
miny = min(miny, min(y1, y2));
maxy = max(maxy, max(y1, y2));
}
if (miny < uborder) miny = uborder;
@ -6340,7 +6451,7 @@ int32_t fillsector(int16_t sectnum, char fillcolor)
//+((totalclock>>2)&3)
for (sy=miny; sy<=maxy; sy+=3) // JBF 20040116: numframes%3 -> (totalclock>>2)&3
{
y = pos.y+(((sy-midydim16)<<14)/zoom);
y = pos.y + ((sy-midydim16)<<14)/zoom;
fillist[0] = lborder; fillcnt = 1;
for (z=startwall; z<=endwall; z++)
@ -6349,28 +6460,29 @@ int32_t fillsector(int16_t sectnum, char fillcolor)
y1 = wall[z].y; y2 = POINT2(z).y;
if (y1 > y2)
{
tempint = x1; x1 = x2; x2 = tempint;
tempint = y1; y1 = y2; y2 = tempint;
swaplong(&x1, &x2);
swaplong(&y1, &y2);
}
if ((y1 <= y) && (y2 > y))
if (y1 <= y && y < y2)
//if (x1*(y-y2) + x2*(y1-y) <= 0)
{
dax = x1+scale(y-y1,x2-x1,y2-y1);
dax = (((dax-pos.x)*zoom)>>14)+halfxdim16;
if (fillcnt == sizeof(fillist)/sizeof(fillist[0]))
break;
dax = x1 + scale(y-y1, x2-x1, y2-y1);
dax = halfxdim16 + (((dax-pos.x)*zoom)>>14);
if (dax >= lborder)
fillist[fillcnt++] = dax;
}
}
if (fillcnt > 0)
{
for (z=1; z<fillcnt; z++)
for (zz=0; zz<z; zz++)
if (fillist[z] < fillist[zz])
{
tempint = fillist[z];
fillist[z] = fillist[zz];
fillist[zz] = tempint;
}
swaplong(&fillist[z], &fillist[zz]);
for (z=(fillcnt&1); z<fillcnt-1; z+=2)
{
@ -6378,11 +6490,13 @@ int32_t fillsector(int16_t sectnum, char fillcolor)
break;
if (fillist[z+1] > rborder)
fillist[z+1] = rborder;
drawline16(fillist[z],sy, fillist[z+1],sy, 159 //editorcolors[fillcolor]
-klabs(sintable[((totalclock<<3)&2047)]>>11));
}
}
}
return(0);
}
@ -6690,11 +6804,15 @@ nonextsector:
while (j >= 0)
{
m = insertsprite(destsector,sprite[j].statnum);
if (m>=0)
if (m<0)
{
Bmemcpy(&sprite[m],&sprite[j],sizeof(spritetype));
sprite[m].sectnum = destsector; //Don't let memcpy overwrite sector!
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];
}
}

View file

@ -173,6 +173,32 @@ static int16_t maphacklightcnt=0;
static int16_t maphacklight[PR_MAXLIGHTS];
#endif
////////// YAX //////////
#define YAX_BUNCHNUM(Sect, Cf) (*(int16_t *)(&sector[Sect].ceilingxpanning + 6*Cf))
int16_t yax_getbunch(int16_t i, int16_t cf)
{
if (((*(&sector[i].ceilingstat + cf))&YAX_BIT)==0)
return -1;
return YAX_BUNCHNUM(i, cf);
}
void yax_setbunch(int16_t i, int16_t cf, int16_t bunchnum)
{
if (i<0)
{
*(&sector[i].ceilingstat + cf) &= ~YAX_BIT;
YAX_BUNCHNUM(i, cf) = 0;
return;
}
*(&sector[i].ceilingstat + cf) |= YAX_BIT;
YAX_BUNCHNUM(i, cf) = bunchnum;
}
////////// editor side view //////////
int32_t m32_sideview = 0;
int32_t m32_sideelev = 256; // elevation in BUILD degrees, 0..512
@ -295,7 +321,7 @@ int32_t clipmapinfo_load(const char *filename)
int32_t i,k,w, px,py,pz;
int16_t ang,cs;
char fn[BMAX_PATH], loadedwhich[32]= {0}, *lwcp=loadedwhich;
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;
@ -6053,6 +6079,7 @@ static inline void keepaway(int32_t *x, int32_t *y, int32_t w)
y1 = clipit[w].y1; dy = clipit[w].y2-y1;
ox = ksgn(-dy); oy = ksgn(dx);
first = (klabs(dx) <= klabs(dy));
while (1)
{
if (dx*(*y-y1) > (*x-x1)*dy) return;
@ -8929,6 +8956,27 @@ int32_t krecip(int32_t num)
return(krecipasm(num));
}
int32_t spriteheight(int16_t i, int32_t *basez)
{
int32_t hei, flooraligned=((sprite[i].cstat&48)==32);
if (flooraligned)
{
if (basez)
*basez = sprite[i].z;
return 0;
}
hei = (tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<2;
if (basez)
{
*basez = sprite[i].z;
if (sprite[i].cstat&128)
*basez -= (hei>>1);
}
return hei;
}
//
// setsprite
//

View file

@ -3692,11 +3692,12 @@ static int32_t spriteonceilingz(int32_t searchwall)
// int32_t z=sprite[searchwall].z;
int32_t z = getceilzofslope(searchsector,sprite[searchwall].x,sprite[searchwall].y);
int32_t tmphei = spriteheight(searchwall, NULL);
if (sprite[searchwall].cstat&128)
z -= ((tilesizy[sprite[searchwall].picnum]*sprite[searchwall].yrepeat)<<1);
z -= tmphei>>1;
if ((sprite[searchwall].cstat&48) != 32)
z += ((tilesizy[sprite[searchwall].picnum]*sprite[searchwall].yrepeat)<<2);
z += tmphei;
return z;
}
@ -3707,7 +3708,7 @@ static int32_t spriteongroundz(int32_t searchwall)
int32_t z = getflorzofslope(searchsector,sprite[searchwall].x,sprite[searchwall].y);
if (sprite[searchwall].cstat&128)
z -= ((tilesizy[sprite[searchwall].picnum]*sprite[searchwall].yrepeat)<<1);
z -= spriteheight(searchwall, NULL)>>1;
return z;
}
@ -4271,6 +4272,7 @@ static void mouseaction_movesprites(int32_t *sumxvect, int32_t *sumyvect, int32_
xvect = daxvect;
yvect = dayvect;
// test run
for (ii=0; ii<highlightcnt; ii++)
if (highlight[ii]&16384)
{
@ -4282,6 +4284,7 @@ static void mouseaction_movesprites(int32_t *sumxvect, int32_t *sumyvect, int32_
xvect = (tvec.x - sprite[spi].x)<<14;
yvect = (tvec.y - sprite[spi].y)<<14;
}
// the real thing
for (ii=0; ii<highlightcnt; ii++)
if (highlight[ii]&16384)
{
@ -4653,7 +4656,7 @@ static void Keys3d(void)
if (AIMING_AT_WALL_OR_MASK && PRESSED_KEYSC(PERIOD))
{
AutoAlignWalls((int32_t)searchwall, 0);
AutoAlignWalls(searchwall, 0);
message("Wall %d autoalign", searchwall);
}
@ -4688,7 +4691,7 @@ static void Keys3d(void)
sector[searchsector].ceilingheinum = 0;
}
getnumberptr256("Sector ceiling slope: ", &sector[searchsector].ceilingheinum,
sizeof(sector[0].ceilingheinum), 65536, 1, NULL);
sizeof(sector[0].ceilingheinum), 32767, 1, NULL);
break;
case SEARCH_FLOOR:
getnumberptr256("Sector floorz: ", &sector[searchsector].floorz,
@ -4699,7 +4702,7 @@ static void Keys3d(void)
sector[searchsector].floorstat |= 2;
}
getnumberptr256("Sector floor slope: ", &sector[searchsector].floorheinum,
sizeof(sector[0].floorheinum), 65536, 1, NULL);
sizeof(sector[0].floorheinum), 32767, 1, NULL);
break;
case SEARCH_SPRITE:
@ -5175,16 +5178,19 @@ static void Keys3d(void)
int16_t sect = k ? highlightsector[0] :
((AIMING_AT_WALL && wall[searchwall].nextsector>=0 && (eitherALT && !(bstatus&1))) ?
wall[searchwall].nextsector : searchsector);
int32_t tmphei;
for (j=0; j<(k?k:1); j++, sect=highlightsector[j])
{
for (i=headspritesect[sect]; i!=-1; i=nextspritesect[i])
{
tmphei = spriteheight(i, NULL);
tempint = getceilzofslope(sect, sprite[i].x, sprite[i].y);
tempint += (tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<2;
tempint += tmphei;
if (sprite[i].cstat&128)
tempint += (tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<1;
tempint += tmphei>>1;
if (sprite[i].z == tempint)
sprite[i].z += tsign * (updownunits << (eitherCTRL<<1)); // JBF 20031128
@ -5205,7 +5211,7 @@ static void Keys3d(void)
tempint = getflorzofslope(sect,sprite[i].x,sprite[i].y);
if (sprite[i].cstat&128)
tempint += ((tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<1);
tempint += spriteheight(i, NULL)>>1;
if (sprite[i].z == tempint)
sprite[i].z += tsign * (updownunits << (eitherCTRL<<1)); // JBF 20031128
@ -6866,7 +6872,7 @@ static void Keys2d(void)
}
}
if (PRESSED_KEYSC(E)) // E (expand)
if (!eitherCTRL && PRESSED_KEYSC(E)) // E (expand)
{
for (i=0; i<numsectors; i++)
if (inside(mousxplc,mousyplc,i) == 1)
@ -7131,8 +7137,7 @@ static void Keys2d(void)
sprite[i].ang &= 2047;
printmessage16("Sprite %d updated", i);
}
else if (pointhighlight >= 0 /*<= 16383*/)
else if (pointhighlight >= 0)
{
i = linehighlight;
j = wall[i].x;
@ -9996,11 +10001,23 @@ void ExtCheckKeys(void)
if (asksave == 1 && (bstatus + lastbstatus) == 0 && mapstate)
{
#if 0
int32_t i;
// check keys so that e.g. bunch deletions won't produce
// as much revisions
for (i=sizeof(keystatus)/sizeof(keystatus[0]) - 1; i>=0; i--)
if (keystatus[i])
break;
// message("Saved undo rev %d",map_revision);
create_map_snapshot();
asksave++;
if (i==-1)
#endif
{
create_map_snapshot();
asksave++;
}
}
else if (asksave == 2) asksave++;
else if (asksave == 2)
asksave++;
if (totalclock > autosavetimer && autosave)
{
@ -10532,7 +10549,7 @@ static void EditSectorData(int16_t sectnum)
break;
case 5:
handlemed(0, "Ceiling heinum", "Ceiling Heinum", &sector[sectnum].ceilingheinum,
sizeof(sector[sectnum].ceilingheinum), 65536L, 1);
sizeof(sector[sectnum].ceilingheinum), 32767, 1);
break;
case 6:
handlemed(0, "Palookup number", "Ceiling Palookup Number", &sector[sectnum].ceilingpal,
@ -10546,7 +10563,7 @@ static void EditSectorData(int16_t sectnum)
{
case 0:
handlemed(1, "Flags (hex)", "Floor Flags", &sector[sectnum].floorstat,
sizeof(sector[sectnum].floorstat), 65536, 0);
sizeof(sector[sectnum].floorstat), 65535, 0);
break;
case 1:
@ -10576,7 +10593,7 @@ static void EditSectorData(int16_t sectnum)
break;
case 5:
handlemed(0, "Floor heinum", "Floor Heinum", &sector[sectnum].floorheinum,
sizeof(sector[sectnum].floorheinum), 65536, 1);
sizeof(sector[sectnum].floorheinum), 32767, 1);
break;
case 6:
handlemed(0, "Palookup number", "Floor Palookup Number", &sector[sectnum].floorpal,
@ -10624,7 +10641,7 @@ static void EditWallData(int16_t wallnum)
{
case 0:
handlemed(1, "Flags (hex)", "Flags", &wall[wallnum].cstat,
sizeof(wall[wallnum].cstat), 65536L, 0);
sizeof(wall[wallnum].cstat), 65535, 0);
break;
case 1:
handlemed(0, "Shade", "Shade", &wall[wallnum].shade,
@ -10871,15 +10888,15 @@ static void EditSpriteData(int16_t spritenum)
break;
case 1:
handlemed(0, "X-Velocity", "X-Velocity", &sprite[spritenum].xvel,
sizeof(sprite[spritenum].xvel), 65536, 1);
sizeof(sprite[spritenum].xvel), 65535, 1);
break;
case 2:
handlemed(0, "Y-Velocity", "Y-Velocity", &sprite[spritenum].yvel,
sizeof(sprite[spritenum].yvel), 65536, 1);
sizeof(sprite[spritenum].yvel), 65535, 1);
break;
case 3:
handlemed(0, "Z-Velocity", "Z-Velocity", &sprite[spritenum].zvel,
sizeof(sprite[spritenum].zvel), 65536, 1);
sizeof(sprite[spritenum].zvel), 65535, 1);
break;
case 4:
handlemed(0, "Owner", "Owner", &sprite[spritenum].owner,
@ -10936,10 +10953,10 @@ static void GenericSpriteSearch()
static int32_t maxval[7][3] =
{
{ BXY_MAX , 65536 , 2048 },
{ BXY_MAX , 128 , 65536 },
{ BZ_MAX , MAXPALOOKUPS-1, 65536 },
{ MAXSECTORS-1, 128 , 65536 },
{ BXY_MAX , 65535 , 2048 },
{ BXY_MAX , 128 , 65535 },
{ BZ_MAX , MAXPALOOKUPS-1, 65535 },
{ MAXSECTORS-1, 128 , 65535 },
{ MAXSTATUS-1 , 128 , MAXSPRITES-1 },
{ BTAG_MAX , MAXTILES-1 , 256 },
{ BTAG_MAX , 0 , BTAG_MAX }