* Correctly draw floor-aligned sprites with non-power-of-two textures in classic renderer.

* Sprite cstat 2048 ('use own shade', [N]) now works more or less. (Issues may arise when combined with sector light effects.)
* Begin work on 'smart' tag labeling system for Mapster32.  Right now, it only displays a '+' after tags with linking semantics.
* 


git-svn-id: https://svn.eduke32.com/eduke32@1866 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-04-14 20:48:08 +00:00
parent 1e937bb5aa
commit a2b3b6006c
7 changed files with 650 additions and 185 deletions

View file

@ -75,6 +75,9 @@ extern "C" {
// more user tag hijacking: lotag/extra :/
#define YAX_NEXTWALL(Wall, Cf) (*(&wall[Wall].lotag + 2*Cf))
#define YAX_ITER_WALLS(Wal, Itervar, Cfvar) Cfvar=0, Itervar=(Wal); Itervar!=-1; \
Itervar=yax_getnextwall(Itervar, Cfvar), (void)(Itervar==-1 && Cfvar==0 && (Cfvar=1) && (Itervar=yax_getnextwall((Wal), Cfvar)))
int16_t yax_getbunch(int16_t i, int16_t cf);
void yax_getbunches(int16_t i, int16_t *cb, int16_t *fb);
void yax_setbunch(int16_t i, int16_t cf, int16_t bunchnum);
@ -572,6 +575,7 @@ void alignflorslope(int16_t dasect, int32_t x, int32_t y, int32_t z);
int32_t sectorofwall(int16_t theline);
int32_t sectorofwall_noquick(int16_t theline);
int32_t loopnumofsector(int16_t sectnum, int16_t wallnum);
void setslope(int32_t sectnum, int32_t cf, int16_t slope);
// int32_t insertsprite(int16_t sectnum, int16_t statnum);
// int32_t deletesprite(int16_t spritenum);

View file

@ -141,6 +141,8 @@ void mhline(intptr_t bufplc, uint32_t bx, int32_t cntup16, int32_t junk, uint32_
{
char ch;
UNREFERENCED_PARAMETER(junk);
gbuf = (char *)bufplc;
gpal = (char *)asm3;
for (cntup16>>=16; cntup16>0; cntup16--)
@ -158,6 +160,8 @@ void thline(intptr_t bufplc, uint32_t bx, int32_t cntup16, int32_t junk, uint32_
{
char ch;
UNREFERENCED_PARAMETER(junk);
gbuf = (char *)bufplc;
gpal = (char *)asm3;
if (transmode)

View file

@ -364,20 +364,6 @@ static void yax_resetbunchnums(void)
yax_update(1);
}
static void setslope(int32_t sectnum, int32_t cf, int16_t slope)
{
if (slope==0)
{
SECTORFLD(sectnum,stat, cf) &= ~2;
SECTORFLD(sectnum,heinum, cf) = 0;
}
else
{
SECTORFLD(sectnum,stat, cf) |= 2;
SECTORFLD(sectnum,heinum, cf) = slope;
}
}
// Whether a wall is constrained by sector extensions.
// If false, it's a wall that you can freely move around,
// attach points to, etc...
@ -623,7 +609,8 @@ CANCEL:
#ifdef M32_SHOWDEBUG
if (searchstat>=0 && (searchwall<0 || searchsector<0))
{
Bsprintf(m32_debugstr[m32_numdebuglines++], "inconsistent search variables!");
if (m32_numdebuglines<64)
Bsprintf(m32_debugstr[m32_numdebuglines++], "inconsistent search variables!");
searchstat = -1;
}
@ -982,7 +969,14 @@ void editinput(void)
mainloop_move();
getzrange(&pos,cursectnum, &hiz,&hihit, &loz,&lohit, 128,CLIPMASK0);
/*
{
int32_t his = !(hihit&32768), los = !(lohit&32768);
if (m32_numdebuglines<64)
Bsprintf(m32_debugstr[m32_numdebuglines++], "s%d: cf[%s%d, %s%d] z(%d, %d)", cursectnum,
his?"s":"w",hihit&16383, los?"s":"w",lohit&16383, hiz,loz);
}
*/
oposz = pos.z;
if (zmode == 0)
{
@ -1498,18 +1492,13 @@ static void ovh_whiteoutgrab(void)
//not highlighted on both sides
for (i=highlightsectorcnt-1; i>=0; i--)
{
startwall = sector[highlightsector[i]].wallptr;
endwall = startwall + sector[highlightsector[i]].wallnum;
for (j=startwall; j<endwall; j++)
for (WALLS_OF_SECTOR(highlightsector[i], j))
{
if (wall[j].nextwall >= 0)
{
// for (k=highlightsectorcnt-1; k>=0; k--)
// if (highlightsector[k] == wall[j].nextsector)
// break;
k = wall[j].nextsector;
if ((hlsectorbitmap[k>>3]&(1<<(k&7)))==0)
// if (k < 0)
{
NEXTWALL(j).nextwall = -1;
NEXTWALL(j).nextsector = -1;
@ -1870,6 +1859,10 @@ static void copy_some_wall_members(int16_t dst, int16_t src)
dstwal->lotag = 0; //srcwal->lotag;
dstwal->hitag = 0; //srcwal->hitag;
dstwal->extra = -1; //srcwal->extra;
#ifdef YAX_ENABLE
yax_setnextwall(dst, YAX_CEILING, -1);
yax_setnextwall(dst, YAX_FLOOR, -1);
#endif
}
// helpers for often needed ops:
@ -1917,6 +1910,7 @@ static int32_t ask_above_or_below(void);
// 0: continue
// >0: newnumwalls
// <0: error
// ignore_ret and refsect_ret are for the 'auto-red-wall' feature
static int32_t trace_loop(int32_t j, uint8_t *visitedwall, int16_t *ignore_ret, int16_t *refsect_ret,
int16_t trace_loop_yaxcf)
{
@ -1966,6 +1960,7 @@ static int32_t trace_loop(int32_t j, uint8_t *visitedwall, int16_t *ignore_ret,
Bmemcpy(&wall[k], &wall[j], sizeof(walltype));
wall[k].point2 = k+1;
// TODO: protect lotag/extra; see also hl-sector copying stuff
wall[k].nextsector = wall[k].nextwall = wall[k].extra = -1;
#ifdef YAX_ENABLE
if (trace_loop_yaxcf >= 0)
@ -2902,6 +2897,13 @@ void overheadeditor(void)
numwalls = m;
goto end_yax;
}
if (numwalls != m)
{
message("Sectors to extend must be in one connected component");
numwalls = m;
goto end_yax;
}
//message("loop");
wall[k-1].point2 = numwalls;
numwalls = k;
@ -3193,9 +3195,10 @@ end_yax: ;
{
for (WALLS_OF_SECTOR(highlightsector[i], j))
{
if (wall[j].nextwall >= 0)
checksectorpointer(wall[j].nextwall,wall[j].nextsector);
didmakered |= !!checksectorpointer(j, highlightsector[i]);
// if (wall[j].nextwall >= 0)
// checksectorpointer(wall[j].nextwall,wall[j].nextsector);
if (wall[j].nextwall < 0)
didmakered |= !!checksectorpointer(j, highlightsector[i]);
if (!didmakered)
{
@ -4586,6 +4589,9 @@ check_next_sector: ;
}
asksave = 1;
#ifdef YAX_ENABLE
yax_update(0);
#endif
goto end_space_handling;
}
@ -4809,6 +4815,10 @@ split_not_enough_walls:
}
newnumwalls = -1;
asksave = 1;
#ifdef YAX_ENABLE
yax_update(0);
#endif
}
}
}
@ -4824,7 +4834,8 @@ end_space_handling:
{
startwall = sector[i].wallptr;
for (j=startwall; j<numwalls; j++)
if (wall[j].point2 < startwall) startwall = wall[j].point2;
if (startwall > wall[j].point2)
startwall = wall[j].point2;
sector[i].wallptr = startwall;
}
for (i=numsectors-2; i>=0; i--)
@ -4849,7 +4860,7 @@ end_space_handling:
if (linehighlight >= 0)
{
checksectorpointer(linehighlight,sectorofwall(linehighlight));
printmessage16("Highlighted line pointers checked.");
printmessage16("Checked pointers of highlighted line.");
asksave = 1;
}
}
@ -5023,10 +5034,68 @@ point_not_inserted:
else
{
#ifdef YAX_ENABLE
int32_t sec = sectorofwall(linehighlight);
if (yax_islockedwall(sec, linehighlight))
int32_t sec = sectorofwall(linehighlight), nextw=wall[linehighlight].nextwall;
int32_t tmpcf;
k = linehighlight;
if (yax_islockedwall(sec, k) || yax_islockedwall(wall[k].nextsector, wall[k].nextwall))
{
printmessage16("Inserting point in constrained wall: not implemented!");
// yax'ed wall -- first find out which walls are affected
for (i=0; i<numwalls; i++)
wall[i].cstat &= ~(1<<14);
// round 1
for (YAX_ITER_WALLS(linehighlight, i, tmpcf))
wall[i].cstat |= (1<<14);
if (nextw >= 0)
for (YAX_ITER_WALLS(nextw, i, tmpcf))
wall[i].cstat |= (1<<14);
// round 2 (enough?)
for (YAX_ITER_WALLS(linehighlight, i, tmpcf))
if (wall[i].nextwall >= 0 && (wall[wall[i].nextwall].cstat&(1<<14))==0)
wall[wall[i].nextwall].cstat |= (1<<14);
if (nextw >= 0)
for (YAX_ITER_WALLS(nextw, i, tmpcf))
if (wall[i].nextwall >= 0 && (wall[wall[i].nextwall].cstat&(1<<14))==0)
wall[wall[i].nextwall].cstat |= (1<<14);
j = 0;
for (i=0; i<numwalls; i++)
j += !!(wall[i].cstat&(1<<14));
if (max(numwalls,onewnumwalls)+j > MAXWALLS)
{
printmessage16("Inserting points would exceed wall limit.");
goto end_insert_points;
}
m = 0;
for (i=0; i<numwalls; i++)
{
if (wall[i].cstat&(1<<14))
if (wall[i].nextwall<0 || i<wall[i].nextwall) // || !(NEXTWALL(i).cstat&(1<<14)) ??
{
insertpoint(i, dax,day);
m += 1+(wall[i].nextwall>=0);
}
}
for (i=0; i<numwalls; i++)
{
if (wall[i].cstat&(1<<14))
{
wall[i].cstat &= ~(1<<14);
k = yax_getnextwall(i+1, YAX_CEILING);
if (k >= 0)
yax_setnextwall(i+1, YAX_CEILING, k+1);
k = yax_getnextwall(i+1, YAX_FLOOR);
if (k >= 0)
yax_setnextwall(i+1, YAX_FLOOR, k+1);
}
}
if (m==j)
message("Inserted %d points for constrained wall.", m);
else
message("Inserted %d points for constrained wall (expected %d, WTF?).", m, j);
}
else
#endif
@ -5036,7 +5105,9 @@ point_not_inserted:
}
}
}
#ifdef YAX_ENABLE
end_insert_points:
#endif
backup_drawn_walls(1);
asksave = 1;
@ -5661,12 +5732,27 @@ static int32_t getlinehighlight(int32_t xplc, int32_t yplc, int32_t line)
if (closest>=0 && wall[closest].nextwall >= 0)
{
//if red line, allow highlighting of both sides
x1 = wall[closest].x;
y1 = wall[closest].y;
x2 = POINT2(closest).x;
y2 = POINT2(closest).y;
if (dmulscale32(daxplc-x1,y2-y1,-(x2-x1),dayplc-y1) >= 0)
closest = wall[closest].nextwall;
if (m32_sideview)
{
x1 = m32_wallscreenxy[closest][0];
y1 = m32_wallscreenxy[closest][1];
x2 = m32_wallscreenxy[wall[closest].point2][0];
y2 = m32_wallscreenxy[wall[closest].point2][1];
}
else
{
x1 = wall[closest].x;
y1 = wall[closest].y;
x2 = POINT2(closest).x;
y2 = POINT2(closest).y;
}
i = wall[closest].nextwall;
if (!m32_sideview ||
((*(int64_t *)m32_wallscreenxy[closest]==*(int64_t *)m32_wallscreenxy[wall[i].point2]) &&
(*(int64_t *)m32_wallscreenxy[wall[closest].point2]==*(int64_t *)m32_wallscreenxy[i])))
if (dmulscale32(daxplc-x1,y2-y1,-(x2-x1),dayplc-y1) >= 0)
closest = wall[closest].nextwall;
}
return closest;
@ -5867,7 +5953,9 @@ static void insertpoint(int16_t linehighlight, int32_t dax, int32_t day)
movewalls(j+1, +1);
Bmemcpy(&wall[j+1], &wall[j], sizeof(walltype));
#ifdef YAX_ENABLE
wall[j+1].cstat &= ~(1<<14);
#endif
wall[j].point2 = j+1;
wall[j+1].x = dax;
wall[j+1].y = day;
@ -5888,7 +5976,9 @@ static void insertpoint(int16_t linehighlight, int32_t dax, int32_t day)
movewalls(k+1, +1);
Bmemcpy(&wall[k+1], &wall[k], sizeof(walltype));
#ifdef YAX_ENABLE
wall[k+1].cstat &= ~(1<<14);
#endif
wall[k].point2 = k+1;
wall[k+1].x = dax;
wall[k+1].y = day;

View file

@ -283,10 +283,15 @@ void yax_setnextwall(int16_t wal, int16_t cf, int16_t thenextwall)
}
if (thenextwall >= 0)
{
wall[wal].cstat |= YAX_NEXTWALLBIT(cf);
YAX_NEXTWALL(wal, cf) = thenextwall;
}
else
{
wall[wal].cstat &= ~YAX_NEXTWALLBIT(cf);
YAX_NEXTWALL(wal, cf) = thenextwall;
YAX_NEXTWALL(wal, cf) = cf?-1:0;
}
}
//// in-struct --> array transfer; list construction
@ -365,6 +370,23 @@ void yax_update(int32_t onlyreset)
#endif
//
// setslope
//
void setslope(int32_t sectnum, int32_t cf, int16_t slope)
{
if (slope==0)
{
SECTORFLD(sectnum,stat, cf) &= ~2;
SECTORFLD(sectnum,heinum, cf) = 0;
}
else
{
SECTORFLD(sectnum,stat, cf) |= 2;
SECTORFLD(sectnum,heinum, cf) = slope;
}
}
////////// editor side view //////////
int32_t m32_sideview = 0;
int32_t m32_sideelev = 256; // elevation in BUILD degrees, 0..512
@ -931,40 +953,47 @@ int32_t checksectorpointer(int16_t i, int16_t sectnum)
x2 = (wall[wall[i].point2]).x;
y2 = (wall[wall[i].point2]).y;
if (wall[i].nextwall >= 0) //Check for early exit
k = wall[i].nextwall;
if (k >= 0) //Check for early exit
{
k = wall[i].nextwall;
if (wall[k].x == x2 && wall[k].y == y2)
if ((wall[wall[k].point2]).x == x1 && (wall[wall[k].point2]).y == y1)
return(0);
return 0;
wall[k].nextwall = wall[k].nextsector = -1;
}
wall[i].nextsector = -1;
wall[i].nextwall = -1;
wall[i].nextsector = wall[i].nextwall = -1;
for (j=0; j<numsectors; j++)
{
startwall = sector[j].wallptr;
endwall = startwall + sector[j].wallnum - 1;
for (k=startwall; k<=endwall; k++)
{
if (wall[k].x == x2 && wall[k].y == y2)
if (wall[wall[k].point2].x == x1 && wall[wall[k].point2].y == y1)
if (j != sectnum)
{
// Don't create link if the other side is connected to another wall.
// The nextwall relation should be definitely one-to-one at all times!
if (wall[k].nextwall>=0 && wall[k].nextwall != i)
continue;
if (wall[k].x != x2 || wall[k].y != y2)
continue;
if (sectnum != -2) // -2 means dry run
{
wall[i].nextsector = j;
wall[i].nextwall = k;
wall[k].nextsector = sectnum;
wall[k].nextwall = i;
}
numnewwalls++;
}
if (wall[wall[k].point2].x != x1 || wall[wall[k].point2].y != y1)
continue;
if (j == sectnum)
continue;
// Don't create link if the other side is connected to another wall.
// The nextwall relation should be definitely one-to-one at all times!
if (wall[k].nextwall>=0 && wall[k].nextwall != i)
continue;
if (sectnum != -2 && numnewwalls==0) // -2 means dry run
{
wall[i].nextsector = j;
wall[i].nextwall = k;
wall[k].nextsector = sectnum;
wall[k].nextwall = i;
}
numnewwalls++;
}
}
return(numnewwalls);
@ -1305,6 +1334,7 @@ char globalxshift, globalyshift;
int32_t globalxpanning, globalypanning, globalshade;
int16_t globalpicnum, globalshiftval;
int32_t globalzd, globalyscale, globalorientation;
static int32_t globalxspan, globalyspan, globalispow2=1; // true if texture has power-of-two x and y size
intptr_t globalbufplc;
int32_t globalx1, globaly1, globalx2, globaly2, globalx3, globaly3, globalzx;
int32_t globalx, globaly, globalz;
@ -1543,7 +1573,7 @@ static void scansector(int16_t sectnum)
rx2[numscans] = xp2; ry2[numscans] = yp2;
p2[numscans] = numscans+1;
numscans++;
skipitaddwall:
skipitaddwall:
if ((wall[z].point2 < z) && (scanfirst < numscans))
p2[numscans-1] = scanfirst, scanfirst = numscans;
@ -2877,6 +2907,59 @@ static inline void transmaskwallscan(int32_t x1, int32_t x2)
faketimerhandler();
}
////////// NON-power-of-two replacements for mhline/thline, adapted from a.c //////////
static void nonpow2_mhline(intptr_t bufplc, uint32_t bx, int32_t cntup16, int32_t junk, uint32_t by, intptr_t p)
{
char ch;
char *gbuf = (char *)bufplc;
char *gpal = (char *)asm3;
UNREFERENCED_PARAMETER(junk);
for (cntup16>>=16; cntup16>0; cntup16--)
{
ch = gbuf[(((uint64_t)bx)/((1ull<<32)/globalxspan))*globalyspan + ((uint64_t)by)/((1ull<<32)/globalyspan)];
if (ch != 255) *((char *)p) = gpal[ch];
bx += asm1;
by += asm2;
p++;
}
}
static void nonpow2_thline(intptr_t bufplc, uint32_t bx, int32_t cntup16, int32_t junk, uint32_t by, intptr_t p)
{
char ch;
char *gbuf = (char *)bufplc;
char *gpal = (char *)asm3;
UNREFERENCED_PARAMETER(junk);
if (globalorientation&512)
{
for (cntup16>>=16; cntup16>0; cntup16--)
{
ch = gbuf[(((uint64_t)bx)/((1ull<<32)/globalxspan))*globalyspan + ((uint64_t)by)/((1ull<<32)/globalyspan)];
if (ch != 255) *((char *)p) = transluc[(*((char *)p))+(gpal[ch]<<8)];
bx += asm1;
by += asm2;
p++;
}
}
else
{
for (cntup16>>=16; cntup16>0; cntup16--)
{
ch = gbuf[(((uint64_t)bx)/((1ull<<32)/globalxspan))*globalyspan + ((uint64_t)by)/((1ull<<32)/globalyspan)];
if (ch != 255) *((char *)p) = transluc[((*((char *)p))<<8)+gpal[ch]];
bx += asm1;
by += asm2;
p++;
}
}
}
////////// END non-power-of-two replacements //////////
//
// ceilspritehline (internal)
@ -2899,11 +2982,23 @@ static inline void ceilspritehline(int32_t x2, int32_t y)
asm3 = FP_OFF(palookup[globalpal]) + (getpalookup((int32_t)mulscale28(klabs(v),globvis),globalshade)<<8);
if ((globalorientation&2) == 0)
mhline(globalbufplc,bx,(x2-x1)<<16,0L,by,ylookup[y]+x1+frameoffset);
if (globalispow2)
{
if ((globalorientation&2) == 0)
mhline(globalbufplc,bx,(x2-x1)<<16,0L,by,ylookup[y]+x1+frameoffset);
else
{
thline(globalbufplc,bx,(x2-x1)<<16,0L,by,ylookup[y]+x1+frameoffset);
}
}
else
{
thline(globalbufplc,bx,(x2-x1)<<16,0L,by,ylookup[y]+x1+frameoffset);
if ((globalorientation&2) == 0)
nonpow2_mhline(globalbufplc,bx,(x2-x1)<<16,0L,by,ylookup[y]+x1+frameoffset);
else
{
nonpow2_thline(globalbufplc,bx,(x2-x1)<<16,0L,by,ylookup[y]+x1+frameoffset);
}
}
}
@ -4660,13 +4755,14 @@ static void drawsprite(int32_t snum)
if (sec->visibility != 0) globvis = mulscale4(globvis,(int32_t)((uint8_t)(sec->visibility+16)));
x = picsiz[globalpicnum]; y = ((x>>4)&15); x &= 15;
#if 0
if (pow2long[x] != xspan)
{
x++;
globalx1 = mulscale(globalx1,xspan,x);
globalx2 = mulscale(globalx2,xspan,x);
}
#endif
dax = globalxpanning; day = globalypanning;
globalxpanning = -dmulscale6(globalx1,day,globalx2,dax);
globalypanning = -dmulscale6(globaly1,day,globaly2,dax);
@ -4683,8 +4779,13 @@ static void drawsprite(int32_t snum)
else
tsethlineshift(x,y);
globalispow2 = (pow2long[x]==xspan && pow2long[y]==yspan);
globalxspan = xspan;
globalyspan = yspan;
//Draw it!
ceilspritescan(lx,rx-1);
globalispow2 = 1;
}
else if ((cstat&48) == 48)
{
@ -9838,19 +9939,89 @@ int32_t neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ang
// dragpoint
//
void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day)
#ifdef YAX_ENABLE
{
int32_t thelastwall, cnt, w, clockwise;
int32_t i, j, numyaxwalls=0, tmpcf;
static int16_t yaxwalls[MAXWALLS];
uint8_t *walbitmap = (uint8_t *)tempbuf;
Bmemset(walbitmap, 0, (numwalls+7)>>3);
yaxwalls[numyaxwalls++] = pointhighlight;
for (i=0; i<numyaxwalls; i++)
{
w = yaxwalls[i];
cnt = MAXWALLS;
clockwise = 0;
while (1)
{
wall[w].x = dax;
wall[w].y = day;
walbitmap[w>>3] |= (1<<(w&7));
for (YAX_ITER_WALLS(w, j, tmpcf))
{
if ((walbitmap[j>>3]&(1<<(j&7)))==0)
{
walbitmap[j>>3] |= (1<<(j&7));
yaxwalls[numyaxwalls++] = j;
}
}
if (clockwise==0) //search points CCW
{
if (wall[w].nextwall >= 0)
w = wall[wall[w].nextwall].point2;
else
clockwise = 1;
}
if (clockwise==1)
{
thelastwall = lastwall(w);
if (wall[thelastwall].nextwall >= 0)
w = wall[thelastwall].nextwall;
else
break;
}
cnt--;
if ((walbitmap[w>>3] & (1<<(w&7))) || cnt==0)
break;
}
}
if (editstatus)
{
for (w=0; w<numwalls; w++)
if (walbitmap[w>>3] & (1<<(w&7)))
wall[w].cstat |= (1<<14);
if (linehighlight >= 0 && linehighlight < MAXWALLS)
wall[linehighlight].cstat |= (1<<14);
wall[lastwall(pointhighlight)].cstat |= (1<<14);
}
}
#else
{
int16_t cnt, tempshort;
int32_t thelastwall;
wall[pointhighlight].x = dax;
wall[pointhighlight].y = day;
wall[pointhighlight].cstat |= (1<<14);
if (linehighlight >= 0 && linehighlight < MAXWALLS)
wall[linehighlight].cstat |= (1<<14);
wall[lastwall(pointhighlight)].cstat |= (1<<14);
cnt = MAXWALLS;
tempshort = pointhighlight; //search points CCW
cnt = MAXWALLS;
wall[tempshort].x = dax;
wall[tempshort].y = day;
if (editstatus)
{
wall[pointhighlight].cstat |= (1<<14);
if (linehighlight >= 0 && linehighlight < MAXWALLS)
wall[linehighlight].cstat |= (1<<14);
wall[lastwall(pointhighlight)].cstat |= (1<<14);
}
do
{
if (wall[tempshort].nextwall >= 0)
@ -9886,7 +10057,7 @@ void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day)
}
while ((tempshort != pointhighlight) && (cnt > 0));
}
#endif
//
// lastwall
@ -10838,7 +11009,10 @@ int32_t krand(void)
// getzrange
//
void getzrange(const vec3_t *vect, int16_t sectnum,
//extern char m32_debugstr[64][128];
//extern int32_t m32_numdebuglines;
void getzrange(const vec3_t *pos, int16_t sectnum,
int32_t *ceilz, int32_t *ceilhit, int32_t *florz, int32_t *florhit,
int32_t walldist, uint32_t cliptype)
{
@ -10869,10 +11043,10 @@ void getzrange(const vec3_t *vect, int16_t sectnum,
//Extra walldist for sprites on sector lines
i = walldist+MAXCLIPDIST+1;
xmin = vect->x-i; ymin = vect->y-i;
xmax = vect->x+i; ymax = vect->y+i;
xmin = pos->x-i; ymin = pos->y-i;
xmax = pos->x+i; ymax = pos->y+i;
getzsofslope(sectnum,vect->x,vect->y,ceilz,florz);
getzsofslope(sectnum,pos->x,pos->y,ceilz,florz);
*ceilhit = sectnum+16384; *florhit = sectnum+16384;
dawalclipmask = (cliptype&65535);
@ -10916,7 +11090,7 @@ restart_grand:
continue;
}
clipsprite_initindex(curidx, curspr, &clipsectcnt, vect);
clipsprite_initindex(curidx, curspr, &clipsectcnt, pos);
for (i=0; i<clipsectnum; i++)
{
@ -10926,19 +11100,19 @@ restart_grand:
if (k==sectq[clipinfo[curidx].qend])
continue;
getzsofslope((int16_t)k,vect->x,vect->y,&daz,&daz2);
getzsofslope(sectq[clipinfo[curidx].qend],vect->x,vect->y,&cz,&fz);
getzsofslope((int16_t)k,pos->x,pos->y,&daz,&daz2);
getzsofslope(sectq[clipinfo[curidx].qend],pos->x,pos->y,&cz,&fz);
hitwhat = (curspr-sprite)+49152;
if ((sector[k].ceilingstat&1)==0)
{
if (vect->z < cz && cz < *florz) { *florz = cz; *florhit = hitwhat; }
if (vect->z > daz && daz > *ceilz) { *ceilz = daz; *ceilhit = hitwhat; }
if (pos->z < cz && cz < *florz) { *florz = cz; *florhit = hitwhat; }
if (pos->z > daz && daz > *ceilz) { *ceilz = daz; *ceilhit = hitwhat; }
}
if ((sector[k].floorstat&1)==0)
{
if (vect->z < daz2 && daz2 < *florz) { *florz = daz2; *florhit = hitwhat; }
if (vect->z > fz && fz > *ceilz) { *ceilz = fz; *ceilhit = hitwhat; }
if (pos->z < daz2 && daz2 < *florz) { *florz = daz2; *florhit = hitwhat; }
if (pos->z > fz && fz > *ceilz) { *ceilz = fz; *ceilhit = hitwhat; }
}
}
}
@ -10959,7 +11133,7 @@ restart_grand:
if ((y1 > ymax) && (y2 > ymax)) continue;
dx = x2-x1; dy = y2-y1;
if (dx*(vect->y-y1) < (vect->x-x1)*dy) continue; //back
if (dx*(pos->y-y1) < (pos->x-x1)*dy) continue; //back
if (dx > 0) dax = dx*(ymin-y1); else dax = dx*(ymax-y1);
if (dy > 0) day = dy*(xmax-x1); else day = dy*(xmin-x1);
if (dax >= day) continue;
@ -10976,8 +11150,8 @@ restart_grand:
}
else if (editstatus == 0)
{
if (((sec->ceilingstat&1) == 0) && (vect->z <= sec->ceilingz+(3<<8))) continue;
if (((sec->floorstat&1) == 0) && (vect->z >= sec->floorz-(3<<8))) continue;
if (((sec->ceilingstat&1) == 0) && (pos->z <= sec->ceilingz+(3<<8))) continue;
if (((sec->floorstat&1) == 0) && (pos->z >= sec->floorz-(3<<8))) continue;
}
for (i=clipsectnum-1; i>=0; i--)
@ -10993,21 +11167,21 @@ restart_grand:
if (dax >= day) continue;
//It actually got here, through all the continue's!!!
getzsofslope(k, vect->x,vect->y, &daz,&daz2);
getzsofslope(k, pos->x,pos->y, &daz,&daz2);
if (curspr)
{
int32_t fz,cz, hitwhat=(curspr-sprite)+49152;
getzsofslope(sectq[clipinfo[curidx].qend],vect->x,vect->y,&cz,&fz);
getzsofslope(sectq[clipinfo[curidx].qend],pos->x,pos->y,&cz,&fz);
if ((sec->ceilingstat&1)==0)
{
if (vect->z < cz && cz < *florz) { *florz = cz; *florhit = hitwhat; }
if (vect->z > daz && daz > *ceilz) { *ceilz = daz; *ceilhit = hitwhat; }
if (pos->z < cz && cz < *florz) { *florz = cz; *florhit = hitwhat; }
if (pos->z > daz && daz > *ceilz) { *ceilz = daz; *ceilhit = hitwhat; }
}
if ((sec->floorstat&1)==0)
{
if (vect->z < daz2 && daz2 < *florz) { *florz = daz2; *florhit = hitwhat; }
if (vect->z > fz && fz > *ceilz) { *ceilz = fz; *ceilhit = hitwhat; }
if (pos->z < daz2 && daz2 < *florz) { *florz = daz2; *florhit = hitwhat; }
if (pos->z > fz && fz > *ceilz) { *ceilz = fz; *ceilhit = hitwhat; }
}
}
else
@ -11058,7 +11232,7 @@ restart_grand:
{
case 0:
k = walldist+(spr->clipdist<<2)+1;
if ((klabs(x1-vect->x) <= k) && (klabs(y1-vect->y) <= k))
if ((klabs(x1-pos->x) <= k) && (klabs(y1-pos->y) <= k))
{
daz = spr->z;
k = ((tilesizy[spr->picnum]*spr->yrepeat)<<1);
@ -11078,7 +11252,7 @@ restart_grand:
l = tilesizx[tilenum]; k = (l>>1)+xoff;
x1 -= mulscale16(dax,k); x2 = x1+mulscale16(dax,l);
y1 -= mulscale16(day,k); y2 = y1+mulscale16(day,l);
if (clipinsideboxline(vect->x,vect->y,x1,y1,x2,y2,walldist+1) != 0)
if (clipinsideboxline(pos->x,pos->y,x1,y1,x2,y2,walldist+1) != 0)
{
daz = spr->z; k = ((tilesizy[spr->picnum]*spr->yrepeat)<<1);
if (cstat&128) daz += k;
@ -11092,7 +11266,7 @@ restart_grand:
daz = spr->z; daz2 = daz;
if ((cstat&64) != 0)
if ((vect->z > daz) == ((cstat&8)==0)) continue;
if ((pos->z > daz) == ((cstat&8)==0)) continue;
tilenum = spr->picnum;
xoff = (int32_t)((int8_t)((picanm[tilenum]>>8)&255))+((int32_t)spr->xoffset);
@ -11106,8 +11280,8 @@ restart_grand:
yspan = tilesizy[tilenum]; yrepeat = spr->yrepeat;
dax = ((xspan>>1)+xoff)*xrepeat; day = ((yspan>>1)+yoff)*yrepeat;
x1 += dmulscale16(sinang,dax,cosang,day)-vect->x;
y1 += dmulscale16(sinang,day,-cosang,dax)-vect->y;
x1 += dmulscale16(sinang,dax,cosang,day)-pos->x;
y1 += dmulscale16(sinang,day,-cosang,dax)-pos->y;
l = xspan*xrepeat;
x2 = x1 - mulscale16(sinang,l);
y2 = y1 + mulscale16(cosang,l);
@ -11145,8 +11319,8 @@ restart_grand:
if (clipyou != 0)
{
if ((vect->z > daz) && (daz > *ceilz)) { *ceilz = daz; *ceilhit = j+49152; }
if ((vect->z < daz2) && (daz2 < *florz)) { *florz = daz2; *florhit = j+49152; }
if ((pos->z > daz) && (daz > *ceilz)) { *ceilz = daz; *ceilhit = j+49152; }
if ((pos->z < daz2) && (daz2 < *florz)) { *florz = daz2; *florhit = j+49152; }
}
}
}
@ -11178,10 +11352,10 @@ restart_grand:
{
cb = yax_getbunch(origclipsectorlist[i], YAX_CEILING);
for (j=headsectbunch[YAX_FLOOR][cb]; j!=-1; j=nextsectbunch[YAX_FLOOR][j])
if (inside(vect->x,vect->y, j)==1)
if (inside(pos->x,pos->y, j)==1)
{
clipsectorlist[clipsectnum++] = j;
daz = getceilzofslope(j, vect->x,vect->y);
daz = getceilzofslope(j, pos->x,pos->y);
if (!didchange || daz > *ceilz)
didchange=1, *ceilhit = j+16384, *ceilz = daz;
}
@ -11201,14 +11375,14 @@ restart_grand:
{
fb = yax_getbunch(origclipsectorlist[i], YAX_FLOOR);
for (j=headsectbunch[YAX_CEILING][fb]; j!=-1; j=nextsectbunch[YAX_CEILING][j])
if (inside(vect->x,vect->y, j)==1)
if (inside(pos->x,pos->y, j)==1)
{
clipsectorlist[clipsectnum++] = j;
daz = getflorzofslope(j, vect->x,vect->y);
daz = getflorzofslope(j, pos->x,pos->y);
if (!didchange || daz < *florz)
didchange=1, *florhit = j+16384, *florz = daz;
}
}
}
}
if (clipsectnum > 0)
@ -12946,6 +13120,19 @@ static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t
// if (i < wall[j].point2)
drawline16mid(x1,y1, x1,y1+getscreenvdisp(fzn-fz,zoome), editorcolors[col]);
}
#ifdef YAX_ENABLE
{
int16_t nw = yax_getnextwall(i, YAX_CEILING);
if (nw >= 0)
{
int32_t odrawlinepat = drawlinepat;
fz2 = getflorzofslope(sectorofwall(nw), wall[nw].x,wall[nw].y);
drawlinepat = 0x11111111;
drawline16mid(x1,y1, x1,y1+getscreenvdisp(fz2-fz,zoome), editorcolors[col]);
drawlinepat = odrawlinepat;
}
}
#endif
m32_wallscreenxy[i][0] = halfxdim16+x1;
m32_wallscreenxy[i][1] = midydim16+y1;

View file

@ -185,28 +185,19 @@ static uint8_t wallflag[MAXWALLS>>3];
static uint8_t havebunch[YAX_MAXBUNCHES];
static int32_t *tempzar[YAX_MAXBUNCHES];
// check whether bunchnum has exactly one corresponding floor and ceiling
static int32_t yax_is121(int16_t bunchnum)
// Check whether bunchnum has exactly one corresponding floor and ceiling
// and return it in this case. If not 1-to-1, return -1.
static int32_t yax_is121(int16_t bunchnum, int16_t getfloor)
{
int32_t i, ccnt=0, fcnt=0;
int16_t cb, fb;
int32_t i;
i = headsectbunch[0][bunchnum];
if (i<0 || nextsectbunch[0][i]>=0)
return -1;
i = headsectbunch[1][bunchnum];
if (i<0 || nextsectbunch[1][i]>=0)
return -1;
for (i=0; i<numsectors; i++)
{
yax_getbunches(i, &cb, &fb);
if (cb>=0 && cb==bunchnum)
ccnt++;
if (fb>=0 && fb==bunchnum)
fcnt++;
if (ccnt>1 || fcnt>1)
return 0;
}
if (ccnt==1 && fcnt==1)
return 1;
return 0;
return headsectbunch[getfloor][bunchnum];
}
static void silentmessage(const char *fmt, ...);
@ -702,8 +693,8 @@ void ExtLoadMap(const char *mapname)
getmessagetimeoff = 0;
Bstrcpy(levelname,mapname);
pskyoff[0]=0;
for (i=0; i<8; i++) pskyoff[i]=0;
for (i=0; i<8; i++)
pskyoff[i] = 0;
for (i=0; i<numsectors; i++)
{
@ -762,6 +753,110 @@ void ExtSaveMap(const char *mapname)
saveboard("backup.map",&pos.x,&pos.y,&pos.z,&ang,&cursectnum);
}
////////// tag labeling system //////////
#define TLCHR(Cond) ((Cond)?"+":"")
static uint64_t taglab_nolink_SEs = (1ull<<10)|(1ull<<27)|(1ull<<28)|(1ull<<29)|(1ull<<49)|(1ull<<50);
// Whether the individual tags have linking semantics. Based on
// http://infosuite.duke4.net/index.php?page=references_special_textures
// The return value is an OR of the following:
// 1: lotag has linking semantics
// 2: hitag
// 4: extra
// 8: xvel
// 16: yvel
// 32: zvel
// 64: owner
int32_t taglab_linktags(int32_t spritep, int32_t num)
{
int32_t picnum;
int32_t l, link = 0;
if (spritep)
picnum = sprite[num].picnum;
else
picnum = wall[num].picnum;
if (spritep)
{
switch (picnum)
{
case SECTOREFFECTOR:
// SEs potentially link by their hitag
l = sprite[num].lotag;
if (l>=0 && l<=63 && (taglab_nolink_SEs&(1ull<<l)))
break;
if (sprite[num].hitag > 0)
link = 2;
break;
// various lotag-linkers
case ACTIVATOR: case TOUCHPLATE: case ACTIVATORLOCKED: case MASTERSWITCH:
case RESPAWN: // ---
case ACCESSSWITCH: case ACCESSSWITCH2:
case MULTISWITCH: // *
case DIPSWITCH: case TECHSWITCH: case ALIENSWITCH: case TARGET: case DUCK:
case REACTOR:
case CAMERA1:
if (sprite[num].lotag > 0)
link = 1;
break;
// various hitag-linkers
case VIEWSCREEN2: case VIEWSCREEN:
case CRACK1: case CRACK2: case CRACK3: case CRACK4: case FIREEXT:
case FEM1: case FEM2: case FEM3: case FEM4: case FEM5: case FEM6:
case FEM7: case FEM8: case FEM9: case FEM10: case PODFEM1: case NAKED1: //case STATUE: //?
case SEENINE: case OOZFILTER:
case CRANEPOLE: case CRANE:
case NATURALLIGHTNING:
if (sprite[num].hitag > 0)
link = 2;
break;
}
}
else // walls
{
switch (picnum)
{
case TECHLIGHT2: case TECHLIGHT4: case WALLLIGHT4:
case WALLLIGHT3: case WALLLIGHT1: case WALLLIGHT2:
case BIGFORCE: case W_FORCEFIELD:
if (sprite[num].lotag > 0)
link = 1;
break;
}
}
if (!link)
{
// try a few that work both as sprites and as walls
switch (picnum)
{
case ACCESSSWITCH: case SLOTDOOR: case LIGHTSWITCH: case SPACEDOORSWITCH:
case SPACELIGHTSWITCH: case FRANKENSTINESWITCH: case MULTISWITCH:
case DIPSWITCH: case DIPSWITCH2: case TECHSWITCH: case DIPSWITCH3:
case ACCESSSWITCH2: case LIGHTSWITCH2: case POWERSWITCH1: case LOCKSWITCH1:
case POWERSWITCH2: case HANDSWITCH: case PULLSWITCH: case ALIENSWITCH: // ---
case DOORTILE5: case DOORTILE6: case DOORTILE1: case DOORTILE2: case DOORTILE3:
case DOORTILE4: case DOORTILE7: case DOORTILE8: case DOORTILE9: case DOORTILE10:
case DOORTILE22: case DOORTILE18: case DOORTILE19: case DOORTILE20:
case DOORTILE14: case DOORTILE16: case DOORTILE15: case DOORTILE21:
case DOORTILE17: case DOORTILE11: case DOORTILE12: case DOORTILE23: // ---
if ((!spritep && wall[num].lotag>0) || (spritep && sprite[num].lotag>0))
link = 1;
break;
}
}
// TODO: link up with m32script to make custom defs possible
return link;
}
////////// end tag labeling system //////////
static int32_t getTileGroup(const char *groupName)
{
int32_t temp;
@ -872,17 +967,19 @@ const char *ExtGetWallCaption(int16_t wallnum)
tempbuf[0] = 0;
else
{
int32_t lt = taglab_linktags(0, wallnum);
#ifdef YAX_ENABLE
if (yax_getnextwall(wallnum, YAX_CEILING) >= 0) // ceiling nextwall: lotag
{
if (wall[wallnum].hitag == 0)
tempbuf[0] = 0;
else
Bsprintf(tempbuf, "%hu,*", wall[wallnum].hitag);
Bsprintf(tempbuf, "%hu%s,*", wall[wallnum].hitag, TLCHR(lt&2));
}
else
#endif
Bsprintf(tempbuf, "%hu,%hu", wall[wallnum].hitag, wall[wallnum].lotag);
Bsprintf(tempbuf, "%hu%s,%hu%s", wall[wallnum].hitag, TLCHR(lt&2),
wall[wallnum].lotag, TLCHR(lt&1));
}
return(tempbuf);
@ -918,11 +1015,11 @@ const char *SectorEffectorTagText(int32_t lotag)
"DROP FLOOR (ST 28)",
"TEETH DOOR (ST 29)",
"1-WAY SE7 DESTINATION (H=SE 7)",
"CONVAYER BELT",
"CONVEYER BELT",
"ENGINE", // 25
"(UNKNOWN)",
"CAMERA FOR PLAYBACK",
"LIGHTNING (H= TILE#4890)",
"LIGHTNING (H=TILE#4890)",
"FLOAT",
"2 WAY TRAIN (ST=31)", // 30
"FLOOR RISE",
@ -938,7 +1035,7 @@ const char *SectorEffectorTagText(int32_t lotag)
switch (lotag)
{
case 36:
Bsprintf(tempbuf,"%d: SKRINK RAY SHOOTER",lotag);
Bsprintf(tempbuf,"%d: SHOOTER",lotag);
break;
case 49:
Bsprintf(tempbuf,"%d: POINT LIGHT",lotag);
@ -990,7 +1087,7 @@ const char *SectorEffectorText(int32_t spritenum)
const char *ExtGetSpriteCaption(int16_t spritenum)
{
static char tempbuf[1024];
int32_t retfast = 0;
int32_t retfast = 0, lt;
Bmemset(tempbuf,0,sizeof(tempbuf));
@ -1004,13 +1101,17 @@ const char *ExtGetSpriteCaption(int16_t spritenum)
if (retfast)
return(tempbuf);
lt = taglab_linktags(1, spritenum);
if ((sprite[spritenum].lotag|sprite[spritenum].hitag) == 0)
{
SpriteName(spritenum,lo);
if (lo[0]!=0)
{
if (sprite[spritenum].pal==1) Bsprintf(tempbuf,"%s (MULTIPLAYER)",lo);
else Bsprintf(tempbuf,"%s",lo);
if (sprite[spritenum].pal==1)
Bsprintf(tempbuf,"%s (MULTIPLAYER)",lo);
else
Bsprintf(tempbuf,"%s",lo);
}
}
else if (sprite[spritenum].picnum==SECTOREFFECTOR)
@ -1018,16 +1119,19 @@ const char *ExtGetSpriteCaption(int16_t spritenum)
if (onnames!=8)
{
Bsprintf(lo,"%s",SectorEffectorText(spritenum));
Bsprintf(tempbuf,"%s, %hu",lo,sprite[spritenum].hitag);
Bsprintf(tempbuf,"%s, %hu%s",lo,sprite[spritenum].hitag, TLCHR(lt&2));
}
}
else
{
SpriteName(spritenum,lo);
if (sprite[spritenum].extra != -1)
Bsprintf(tempbuf,"%hu,%hu,%d %s",sprite[spritenum].hitag,sprite[spritenum].lotag,sprite[spritenum].extra,lo);
Bsprintf(tempbuf,"%hu%s,%hu%s,%d %s", sprite[spritenum].hitag, TLCHR(lt&2),
sprite[spritenum].lotag, TLCHR(lt&1),
sprite[spritenum].extra,lo);
else
Bsprintf(tempbuf,"%hu,%hu %s",sprite[spritenum].hitag,sprite[spritenum].lotag,lo);
Bsprintf(tempbuf,"%hu%s,%hu%s %s", sprite[spritenum].hitag, TLCHR(lt&2),
sprite[spritenum].lotag, TLCHR(lt&1), lo);
}
return(tempbuf);
@ -1187,7 +1291,7 @@ void ExtShowSectorData(int16_t sectnum) //F5
void ExtShowWallData(int16_t wallnum) //F6
{
int32_t i, runi, nextfreetag=0, total=0, x, y, yi;
int32_t i, runi, nextfreetag=0, total=0, x, y, yi, l;
UNREFERENCED_PARAMETER(wallnum);
@ -1224,16 +1328,19 @@ void ExtShowWallData(int16_t wallnum) //F6
case POWERSWITCH2:
case PULLSWITCH:
case ALIENSWITCH:
if (sprite[i].lotag>nextfreetag) nextfreetag = sprite[i].lotag+1;
if (sprite[i].lotag > nextfreetag)
nextfreetag = sprite[i].lotag+1;
break;
//HITAG
case SEENINE:
case OOZFILTER:
case SECTOREFFECTOR:
if (sprite[i].lotag==10 || sprite[i].lotag==27 || sprite[i].lotag==28 || sprite[i].lotag==29)
l = sprite[i].lotag;
if (l>=0 && l<=63 && (taglab_nolink_SEs&(1ull<<l)))
break;
else if (sprite[i].hitag>nextfreetag) nextfreetag=sprite[i].hitag+1;
if (sprite[i].hitag > nextfreetag)
nextfreetag=sprite[i].hitag+1;
break;
default:
break;
@ -3880,7 +3987,10 @@ static void tileinfo_doprint(int32_t x, int32_t y, char *buf, const char *label,
printext256(x, y+i*pos, whitecol, -1, buf, small);
}
static void drawtileinfo(const char *title,int32_t x,int32_t y,int32_t picnum,int32_t shade,int32_t pal,int32_t cstat,int32_t lotag,int32_t hitag,int32_t extra)
// flags: 1:draw asterisk for lotag
// 2:draw asterisk for extra
static void drawtileinfo(const char *title,int32_t x,int32_t y,int32_t picnum,int32_t shade,int32_t pal,int32_t cstat,
int32_t lotag,int32_t hitag,int32_t extra, uint32_t flags)
{
char buf[64];
int32_t small = (xdimgame<=640);
@ -3911,9 +4021,9 @@ static void drawtileinfo(const char *title,int32_t x,int32_t y,int32_t picnum,in
tileinfo_doprint(x, y, buf, "Shd", shade, 2);
tileinfo_doprint(x, y, buf, "Pal", pal, 3);
tileinfo_doprint(x, y, buf, "Cst", cstat, 4);
tileinfo_doprint(x, y, buf, "Lot", lotag, 5);
tileinfo_doprint(x, y, buf, (flags&1)?"Lo*":"Lot", lotag, 5);
tileinfo_doprint(x, y, buf, "Hit", hitag, 6);
tileinfo_doprint(x, y, buf, "Ext", extra, 7);
tileinfo_doprint(x, y, buf, (flags&2)?"Ex*":"Ext", extra, 7);
enddrawing();
}
@ -4498,14 +4608,14 @@ static void Keys3d(void)
}
}
#endif
drawtileinfo("Clipboard",3,124,temppicnum,tempshade,temppal,tempcstat,templotag,temphitag,tempextra);
drawtileinfo("Clipboard",3,124,temppicnum,tempshade,temppal,tempcstat,templotag,temphitag,tempextra,0);
}// end if usedcount
if (searchsector > -1 && searchsector < numsectors)
{
char lines[8][64];
int32_t dist, height1=0,height2=0,height3=0, num=0;
int32_t x,y;
int32_t x,y,flags=0;
int16_t w;
if (infobox&1)
@ -4517,10 +4627,13 @@ static void Keys3d(void)
case SEARCH_WALL:
case SEARCH_MASKWALL:
w = SELECT_WALL();
#ifdef YAX_ENABLE
flags |= (yax_getnextwall(searchwall, YAX_CEILING)>=0) + 2*(yax_getnextwall(searchwall, YAX_FLOOR)>=0);
#endif
drawtileinfo("Current", WIND1X,WIND1Y,
AIMING_AT_WALL ? wall[w].picnum : wall[w].overpicnum,
wall[w].shade, wall[w].pal, wall[searchwall].cstat,
wall[searchwall].lotag, wall[searchwall].hitag,wall[searchwall].extra);
wall[searchwall].lotag, wall[searchwall].hitag, wall[searchwall].extra,flags);
dist = wallength(searchwall);
@ -4552,7 +4665,7 @@ static void Keys3d(void)
case SEARCH_FLOOR:
drawtileinfo("Current", WIND1X, WIND1Y, AIMED_CEILINGFLOOR(picnum), AIMED_CEILINGFLOOR(shade),
AIMED_CEILINGFLOOR(pal), AIMED_CEILINGFLOOR(stat),
sector[searchsector].lotag, sector[searchsector].hitag, sector[searchsector].extra);
sector[searchsector].lotag, sector[searchsector].hitag, sector[searchsector].extra,0);
{
int32_t xp=AIMED_CEILINGFLOOR(xpanning), yp=AIMED_CEILINGFLOOR(ypanning);
@ -4579,7 +4692,7 @@ static void Keys3d(void)
case SEARCH_SPRITE:
drawtileinfo("Current", WIND1X, WIND1Y, sprite[searchwall].picnum, sprite[searchwall].shade,
sprite[searchwall].pal, sprite[searchwall].cstat, sprite[searchwall].lotag,
sprite[searchwall].hitag, sprite[searchwall].extra);
sprite[searchwall].hitag, sprite[searchwall].extra,0);
Bsprintf(lines[num++], "Repeat: %d,%d", sprite[searchwall].xrepeat, sprite[searchwall].yrepeat);
Bsprintf(lines[num++], "PosXY: %d,%d%s", sprite[searchwall].x, sprite[searchwall].y,
@ -4717,8 +4830,8 @@ static void Keys3d(void)
{
if (AIMING_AT_WALL_OR_MASK)
{
wall[searchwall].cstat = 0;
message("Wall %d cstat = 0", searchwall);
wall[searchwall].cstat &= YAX_NEXTWALLBITS;
message("Wall %d cstat = %d", searchwall, wall[searchwall].cstat);
}
else if (AIMING_AT_SPRITE)
{
@ -4922,9 +5035,16 @@ static void Keys3d(void)
{
if (ASSERT_AIMING)
{
Bsprintf(tempbuf, "%s extra: ", Typestr_wss[searchstat]);
getnumberptr256(tempbuf, &AIMED(extra), sizeof(int16_t), BTAG_MAX, 1, NULL);
asksave = 1;
#ifdef YAX_ENABLE
if (AIMING_AT_WALL_OR_MASK && yax_getnextwall(searchwall, YAX_FLOOR)>=0)
message("Can't change extra in protected wall");
else
#endif
{
Bsprintf(tempbuf, "%s extra: ", Typestr_wss[searchstat]);
getnumberptr256(tempbuf, &AIMED(extra), sizeof(int16_t), BTAG_MAX, 1, NULL);
asksave = 1;
}
}
}
@ -5740,6 +5860,11 @@ static void Keys3d(void)
{
if (AIMING_AT_WALL_OR_MASK)
{
#ifdef YAX_ENABLE
if (yax_getnextwall(searchwall, YAX_CEILING)>=0)
message("Can't change lotag in protected wall");
else
#endif
wall[searchwall].lotag = getnumber256("Wall lotag: ", wall[searchwall].lotag, BTAG_MAX, 0);
}
else if (AIMING_AT_CEILING_OR_FLOOR)
@ -5846,15 +5971,16 @@ static void Keys3d(void)
{
if (ASSERT_AIMING)
{
int16_t opicnum = AIMED_CF_SEL(picnum), aimspr=AIMING_AT_SPRITE;
int16_t opicnum = AIMED_CF_SEL(picnum), aimspr=AIMING_AT_SPRITE, osearchwall=searchwall;
static const char *Typestr_tmp[5] = { "Wall", "Sector ceiling", "Sector floor", "Sprite", "Masked wall" };
Bsprintf(tempbuf, "%s picnum: ", Typestr_tmp[searchstat]);
getnumberptr256(tempbuf, &AIMED_CF_SEL(picnum), sizeof(int16_t), MAXTILES-1, 0, NULL);
if (opicnum != AIMED_CF_SEL(picnum))
asksave = 1;
// need to use the old value because aiming might have changed in getnumberptr256
if (aimspr)
correct_sprite_yoffset(searchwall);
correct_sprite_yoffset(osearchwall);
}
}
@ -5984,7 +6110,7 @@ static void Keys3d(void)
if (tsign)
{
#ifdef YAX_ENABLE
int16_t bunchnum;
int16_t bunchnum, othersidesect=0;
#endif
if (eitherALT)
{
@ -5994,19 +6120,29 @@ static void Keys3d(void)
{
if (AIMING_AT_CEILING || (tsign < 0 && AIMING_AT_WALL_OR_MASK))
#ifdef YAX_ENABLE
if (YAXCHK((bunchnum=yax_getbunch(searchsector, YAX_CEILING)) < 0 || yax_is121(bunchnum)))
if (YAXCHK((bunchnum=yax_getbunch(searchsector, YAX_CEILING)) < 0 ||
(othersidesect=yax_is121(bunchnum, 1))>=0))
#endif
{
alignceilslope(searchsector, sx, sy, getceilzofslope(ns, sx, sy));
#ifdef YAX_ENABLE
if (bunchnum>=0)
setslope(othersidesect, 1, sector[searchsector].ceilingheinum);
#endif
message("Sector %d align ceiling to wall %d", searchsector, searchwall);
}
if (AIMING_AT_FLOOR || (tsign > 0 && AIMING_AT_WALL_OR_MASK))
#ifdef YAX_ENABLE
if (YAXCHK((bunchnum=yax_getbunch(searchsector, YAX_FLOOR)) < 0 || yax_is121(bunchnum)))
if (YAXCHK((bunchnum=yax_getbunch(searchsector, YAX_FLOOR)) < 0 ||
(othersidesect=yax_is121(bunchnum, 0))>=0))
#endif
{
alignflorslope(searchsector, sx, sy, getflorzofslope(ns, sx, sy));
#ifdef YAX_ENABLE
if (bunchnum>=0)
setslope(othersidesect, 0, sector[searchsector].floorheinum);
#endif
message("Sector %d align floor to wall %d", searchsector, searchwall);
}
}
@ -6015,20 +6151,24 @@ static void Keys3d(void)
{
if (AIMING_AT_CEILING_OR_FLOOR)
#ifdef YAX_ENABLE
if (YAXCHK((bunchnum=yax_getbunch(searchsector, AIMING_AT_FLOOR)) < 0 || yax_is121(bunchnum)))
if (YAXCHK((bunchnum=yax_getbunch(searchsector, AIMING_AT_FLOOR)) < 0 ||
(othersidesect=yax_is121(bunchnum, AIMING_AT_CEILING))>=0))
#endif
{
int32_t newslope = clamp(AIMED_CEILINGFLOOR(heinum) + tsign*i, -BHEINUM_MAX, BHEINUM_MAX);
if (!(AIMED_CEILINGFLOOR(stat)&2))
AIMED_CEILINGFLOOR(heinum) = 0;
AIMED_CEILINGFLOOR(heinum) = clamp(AIMED_CEILINGFLOOR(heinum) + tsign*i,
-BHEINUM_MAX, BHEINUM_MAX);
setslope(searchsector, AIMING_AT_FLOOR, newslope);
#ifdef YAX_ENABLE
if (bunchnum >= 0)
setslope(othersidesect, !AIMING_AT_FLOOR, newslope);
#endif
silentmessage("Sector %d %s slope = %d", searchsector,
typestr[searchstat], AIMED_CEILINGFLOOR(heinum));
}
}
/*
if (sector[searchsector].ceilingheinum == 0)
sector[searchsector].ceilingstat &= ~2;
else
@ -6038,6 +6178,7 @@ static void Keys3d(void)
sector[searchsector].floorstat &= ~2;
else
sector[searchsector].floorstat |= 2;
*/
asksave = 1;
}
@ -6386,7 +6527,7 @@ static void Keys3d(void)
tempxrepeat = AIMED_SEL_WALL(xrepeat);
tempxrepeat = max(1, tempxrepeat);
tempyrepeat = AIMED_SEL_WALL(yrepeat);
tempcstat = AIMED_SEL_WALL(cstat);
tempcstat = AIMED_SEL_WALL(cstat) & ~YAX_NEXTWALLBITS;
templenrepquot = divscale12(wallength(searchwall), tempxrepeat);
}
else if (AIMING_AT_CEILING_OR_FLOOR)
@ -6486,7 +6627,8 @@ static void Keys3d(void)
{
wall[i].xrepeat = tempxrepeat;
wall[i].yrepeat = tempyrepeat;
wall[i].cstat = tempcstat;
wall[i].cstat &= YAX_NEXTWALLBITS;
wall[i].cstat |= (tempcstat & ~YAX_NEXTWALLBITS);
fixxrepeat(i, templenrepquot);
}
@ -6556,9 +6698,16 @@ static void Keys3d(void)
{
wall[searchwall].xrepeat = tempxrepeat;
wall[searchwall].yrepeat = tempyrepeat;
wall[searchwall].cstat = tempcstat;
wall[searchwall].cstat &= YAX_NEXTWALLBITS;
wall[searchwall].cstat |= (tempcstat & ~YAX_NEXTWALLBITS);
#ifdef YAX_ENABLE
if (yax_getnextwall(searchwall, YAX_CEILING) == -1)
#endif
wall[searchwall].lotag = templotag;
wall[searchwall].hitag = temphitag;
#ifdef YAX_ENABLE
if (yax_getnextwall(searchwall, YAX_FLOOR) == -1)
#endif
wall[searchwall].extra = tempextra;
fixxrepeat(searchwall, templenrepquot);
}
@ -6577,9 +6726,16 @@ static void Keys3d(void)
{
wall[searchwall].xrepeat = tempxrepeat;
wall[searchwall].yrepeat = tempyrepeat;
wall[searchwall].cstat = tempcstat;
wall[searchwall].cstat &= YAX_NEXTWALLBITS;
wall[searchwall].cstat |= (tempcstat & ~YAX_NEXTWALLBITS);
#ifdef YAX_ENABLE
if (yax_getnextwall(searchwall, YAX_CEILING) == -1)
#endif
wall[searchwall].lotag = templotag;
wall[searchwall].hitag = temphitag;
#ifdef YAX_ENABLE
if (yax_getnextwall(searchwall, YAX_FLOOR) == -1)
#endif
wall[searchwall].extra = tempextra;
fixxrepeat(searchwall, templenrepquot);
}
@ -6708,7 +6864,7 @@ static void Keys3d(void)
wall[w].ypanning = 0;
wall[w].xrepeat = 8;
wall[w].yrepeat = 8;
wall[w].cstat = 0;
wall[w].cstat &= YAX_NEXTWALLBITS;
fixrepeats(searchwall);
}
else if (AIMING_AT_CEILING_OR_FLOOR)
@ -7032,9 +7188,16 @@ static void Keys2d(void)
}
else if (linehighlight >= 0)
{
i = linehighlight;
Bsprintf(buffer,"Wall (%d) Lo-tag: ", i);
wall[i].lotag = getnumber16(buffer, wall[i].lotag, BTAG_MAX, 0);
#ifdef YAX_ENABLE
if (yax_getnextwall(linehighlight, YAX_CEILING)>=0)
message("Can't change lotag in protected wall");
else
#endif
{
i = linehighlight;
Bsprintf(buffer,"Wall (%d) Lo-tag: ", i);
wall[i].lotag = getnumber16(buffer, wall[i].lotag, BTAG_MAX, 0);
}
}
}
else
@ -7107,9 +7270,16 @@ static void Keys2d(void)
}
else if (linehighlight >= 0)
{
i = linehighlight;
Bsprintf(tempbuf,"Wall %d Extra: ",i);
wall[i].extra = getnumber16(tempbuf,wall[i].extra,BTAG_MAX,1);
#ifdef YAX_ENABLE
if (yax_getnextwall(linehighlight, YAX_FLOOR)>=0)
message("Can't change extra in protected wall");
else
#endif
{
i = linehighlight;
Bsprintf(tempbuf,"Wall %d Extra: ",i);
wall[i].extra = getnumber16(tempbuf,wall[i].extra,BTAG_MAX,1);
}
}
}
else
@ -7433,8 +7603,15 @@ static void Keys2d(void)
}
else if (linehighlight >= 0)
{
swapshort(&wall[linehighlight].lotag, &wall[linehighlight].hitag);
printmessage16("Wall %d tags swapped", linehighlight);
#ifdef YAX_ENABLE
if (yax_getnextwall(linehighlight, YAX_CEILING)>=0 || yax_getnextwall(searchwall, YAX_FLOOR)>=0)
message("Can't swap tags in protected wall");
else
#endif
{
swapshort(&wall[linehighlight].lotag, &wall[linehighlight].hitag);
printmessage16("Wall %d tags swapped", linehighlight);
}
}
}
@ -10865,8 +11042,11 @@ static void EditWallData(int16_t wallnum)
switch (row)
{
case 0:
i = wall[wallnum].cstat&YAX_NEXTWALLBITS;
handlemed(1, "Flags (hex)", "Flags", &wall[wallnum].cstat,
sizeof(wall[wallnum].cstat), 65535, 0);
wall[wallnum].cstat &= ~YAX_NEXTWALLBITS;
wall[wallnum].cstat |= i;
break;
case 1:
handlemed(0, "Shade", "Shade", &wall[wallnum].shade,

View file

@ -5692,7 +5692,7 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio)
continue;
}
if (A_CheckSpriteFlags(t->owner,SPRITE_NOSHADE))
if (A_CheckSpriteFlags(t->owner,SPRITE_NOSHADE) || (t->cstat&2048))
l = sprite[t->owner].shade;
else
{

View file

@ -1086,8 +1086,8 @@ static inline void prelevel(char g)
if (PN == SECTOREFFECTOR && SLT == 14)
A_Spawn(-1,i);
if (sprite[i].cstat&2048)
actor[i].flags |= SPRITE_NOSHADE;
// if (sprite[i].cstat&2048)
// actor[i].flags |= SPRITE_NOSHADE;
}
lotaglist = 0;