mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
slightly better linehighlight handling in 2d side-view mode
git-svn-id: https://svn.eduke32.com/eduke32@1865 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
621da89b37
commit
1e937bb5aa
5 changed files with 305 additions and 168 deletions
|
@ -64,15 +64,23 @@ extern "C" {
|
|||
////////// yax defs //////////
|
||||
#define YAX_MAXBUNCHES (MAXSECTORS>>1)
|
||||
#define YAX_BIT 1024
|
||||
// "has next wall when constrained"-bit (1<<10: ceiling, 1<<11: floor)
|
||||
#define YAX_NEXTWALLBIT(Cf) (1<<(10+Cf))
|
||||
#define YAX_NEXTWALLBITS (YAX_NEXTWALLBIT(0)|YAX_NEXTWALLBIT(1))
|
||||
#define YAX_CEILING 0 // don't change!
|
||||
#define YAX_FLOOR 1 // don't change!
|
||||
|
||||
#define SECTORFLD(Sect,Fld, Cf) (*((Cf) ? (§or[Sect].floor##Fld) : (§or[Sect].ceiling##Fld)))
|
||||
|
||||
// more user tag hijacking: lotag/extra :/
|
||||
#define YAX_NEXTWALL(Wall, Cf) (*(&wall[Wall].lotag + 2*Cf))
|
||||
|
||||
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);
|
||||
void yax_setbunches(int16_t i, int16_t cb, int16_t fb);
|
||||
int16_t yax_getnextwall(int16_t wal, int16_t cf);
|
||||
void yax_setnextwall(int16_t wal, int16_t cf, int16_t thenextwall);
|
||||
void yax_update(int32_t onlyreset);
|
||||
|
||||
|
||||
|
@ -134,7 +142,8 @@ typedef struct
|
|||
// bit 7: 1 = Transluscence, 0 = not "T"
|
||||
// bit 8: 1 = y-flipped, 0 = normal "F"
|
||||
// bit 9: 1 = Transluscence reversing, 0 = normal "T"
|
||||
// bits 10-15: reserved
|
||||
// bits 10 and 11: reserved (in use by YAX)
|
||||
// bits 12-15: reserved
|
||||
|
||||
//32 bytes
|
||||
typedef struct
|
||||
|
|
|
@ -76,7 +76,8 @@ extern int32_t m32_sideelev;
|
|||
extern int16_t m32_sideang;
|
||||
extern int32_t m32_sidecos, m32_sidesin;
|
||||
extern int32_t m32_swcnt;
|
||||
extern int16_t *m32_wallsprite;
|
||||
extern int32_t m32_wallscreenxy[MAXWALLS][2];
|
||||
extern int16_t m32_wallsprite[MAXWALLS+MAXSPRITES];
|
||||
extern int8_t sideview_reversehrot;
|
||||
extern inline int32_t scalescreeny(int32_t sy);
|
||||
extern void screencoords(int32_t *xres, int32_t *yres, int32_t x, int32_t y, int32_t zoome) ATTRIBUTE((nonnull));
|
||||
|
|
|
@ -26,24 +26,6 @@ static int32_t crctable[256];
|
|||
static char kensig[64];
|
||||
|
||||
extern const char *ExtGetVer(void);
|
||||
extern int32_t ExtInit(void);
|
||||
extern int32_t ExtPreInit(int32_t argc,const char **argv);
|
||||
extern void ExtUnInit(void);
|
||||
extern void ExtPreCheckKeys(void);
|
||||
extern void ExtAnalyzeSprites(void);
|
||||
extern void ExtCheckKeys(void);
|
||||
extern void ExtLoadMap(const char *mapname);
|
||||
extern void ExtSaveMap(const char *mapname);
|
||||
extern const char *ExtGetSectorCaption(int16_t sectnum);
|
||||
extern const char *ExtGetWallCaption(int16_t wallnum);
|
||||
extern const char *ExtGetSpriteCaption(int16_t spritenum);
|
||||
extern void ExtShowSectorData(int16_t sectnum);
|
||||
extern void ExtShowWallData(int16_t wallnum);
|
||||
extern void ExtShowSpriteData(int16_t spritenum);
|
||||
extern void ExtEditSectorData(int16_t sectnum);
|
||||
extern void ExtEditWallData(int16_t wallnum);
|
||||
extern void ExtEditSpriteData(int16_t spritenum);
|
||||
extern const char *ExtGetSectorType(int32_t lotag);
|
||||
|
||||
extern char spritecol2d[MAXTILES][2];
|
||||
|
||||
|
@ -232,7 +214,8 @@ void fixspritesectors(void);
|
|||
static int32_t movewalls(int32_t start, int32_t offs);
|
||||
int32_t loadnames(const char *namesfile);
|
||||
void updatenumsprites(void);
|
||||
static void getclosestpointonwall(int32_t x, int32_t y, int32_t dawall, int32_t *nx, int32_t *ny);
|
||||
static void getclosestpointonwall(int32_t x, int32_t y, int32_t dawall, int32_t *nx, int32_t *ny,
|
||||
int32_t maybe_screen_coord_p);
|
||||
static void initcrc(void);
|
||||
int32_t gettile(int32_t tilenum);
|
||||
|
||||
|
@ -357,6 +340,21 @@ static void M32_drawdebug(void)
|
|||
#endif
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
static void yax_tweakwalls(int16_t start, int16_t offs)
|
||||
{
|
||||
int32_t i, nw;
|
||||
for (i=0; i<numwalls; i++)
|
||||
{
|
||||
nw = yax_getnextwall(i, YAX_CEILING);
|
||||
if (nw >= start)
|
||||
yax_setnextwall(i, YAX_CEILING, nw+offs);
|
||||
|
||||
nw = yax_getnextwall(i, YAX_FLOOR);
|
||||
if (nw >= start)
|
||||
yax_setnextwall(i, YAX_FLOOR, nw+offs);
|
||||
}
|
||||
}
|
||||
|
||||
static void yax_resetbunchnums(void)
|
||||
{
|
||||
int32_t i;
|
||||
|
@ -384,6 +382,12 @@ static void setslope(int32_t sectnum, int32_t cf, int16_t slope)
|
|||
// If false, it's a wall that you can freely move around,
|
||||
// attach points to, etc...
|
||||
static int32_t yax_islockedwall(int16_t sec, int16_t line)
|
||||
#if 1
|
||||
{
|
||||
UNREFERENCED_PARAMETER(sec);
|
||||
return !!(wall[line].cstat&YAX_NEXTWALLBITS);
|
||||
}
|
||||
#else
|
||||
{
|
||||
int16_t cb,fb, cbn,fbn;
|
||||
int16_t ns = wall[line].nextsector;
|
||||
|
@ -397,26 +401,6 @@ static int32_t yax_islockedwall(int16_t sec, int16_t line)
|
|||
|
||||
return (cb!=cbn || fb!=fbn);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int32_t yax_nextwall(int16_t sec, int16_t line, int32_t downp)
|
||||
{
|
||||
int16_t bunchnum = yax_getbunch(sec, downp);
|
||||
int32_t i, j;
|
||||
|
||||
if (bunchnum==-1)
|
||||
return -1;
|
||||
|
||||
for (i=headsectbunch[!downp][bunchnum]; i!=-1; i=nextsectbunch[!downp][i])
|
||||
{
|
||||
for (j=sector[i].wallptr; j<sector[i].wallptr+sector[i].wallnum; j++)
|
||||
if (*(int64_t *)&wall[j] == *(int64_t *)&wall[line])
|
||||
if (*(int64_t *)&POINT2(j) == *(int64_t *)&POINT2(line))
|
||||
return j;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
# define DEFAULT_YAX_HEIGHT 32768
|
||||
|
@ -1933,11 +1917,16 @@ static int32_t ask_above_or_below(void);
|
|||
// 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)
|
||||
static int32_t trace_loop(int32_t j, uint8_t *visitedwall, int16_t *ignore_ret, int16_t *refsect_ret,
|
||||
int16_t trace_loop_yaxcf)
|
||||
{
|
||||
int16_t refsect, ignore;
|
||||
int32_t k, n, refwall;
|
||||
|
||||
#ifndef YAX_ENABLE
|
||||
UNREFERENCED_PARAMETER(trace_loop_yaxcf);
|
||||
#endif
|
||||
|
||||
if (wall[j].nextwall>=0 || (visitedwall[j>>3]&(1<<(j&7))))
|
||||
return 0;
|
||||
|
||||
|
@ -1978,6 +1967,10 @@ 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;
|
||||
wall[k].nextsector = wall[k].nextwall = wall[k].extra = -1;
|
||||
#ifdef YAX_ENABLE
|
||||
if (trace_loop_yaxcf >= 0)
|
||||
yax_setnextwall(k, trace_loop_yaxcf, j);
|
||||
#endif
|
||||
k++;
|
||||
}
|
||||
|
||||
|
@ -2079,7 +2072,8 @@ static int32_t compare_wall_coords(const void *w1, const void *w2)
|
|||
|
||||
void overheadeditor(void)
|
||||
{
|
||||
char buffer[80], *dabuffer, ch;
|
||||
char buffer[80], ch;
|
||||
const char *dabuffer;
|
||||
int32_t i, j, k, m=0, mousxplc, mousyplc, firstx=0, firsty=0, oposz, col;
|
||||
int32_t tempint, tempint1, tempint2;
|
||||
int32_t startwall=0, endwall, dax, day, x1, y1, x2, y2, x3, y3, x4, y4;
|
||||
|
@ -2276,7 +2270,7 @@ void overheadeditor(void)
|
|||
{
|
||||
int16_t secshort = i;
|
||||
|
||||
dabuffer = (char *)ExtGetSectorCaption(i);
|
||||
dabuffer = ExtGetSectorCaption(i);
|
||||
if (dabuffer[0] == 0)
|
||||
continue;
|
||||
|
||||
|
@ -2299,24 +2293,28 @@ void overheadeditor(void)
|
|||
}
|
||||
|
||||
i = numwalls-1;
|
||||
j = numsectors-1;
|
||||
if (newnumwalls >= 0)
|
||||
i = newnumwalls-1;
|
||||
for (wal=&wall[i]; i>=0; i--,wal--)
|
||||
{
|
||||
if (sector[j].wallptr > i)
|
||||
j--;
|
||||
|
||||
if (zoom < 768 && !(wal->cstat & (1<<14)))
|
||||
continue;
|
||||
|
||||
//Get average point of wall
|
||||
dax = (wal->x+wall[wal->point2].x)>>1;
|
||||
day = (wal->y+wall[wal->point2].y)>>1;
|
||||
if ((dax > x3) && (dax < x4) && (day > y3) && (day < y4))
|
||||
// if ((dax > x3) && (dax < x4) && (day > y3) && (day < y4))
|
||||
{
|
||||
dabuffer = (char *)ExtGetWallCaption(i);
|
||||
dabuffer = ExtGetWallCaption(i);
|
||||
if (dabuffer[0] == 0)
|
||||
continue;
|
||||
|
||||
dax = (wal->x+wall[wal->point2].x)>>1;
|
||||
day = (wal->y+wall[wal->point2].y)>>1;
|
||||
drawsmallabel(dabuffer, editorcolors[0], editorcolors[31],
|
||||
dax, day, getflorzofslope(sectorofwall(i), dax,day));
|
||||
dax, day, getflorzofslope(j, dax,day));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2334,7 +2332,7 @@ void overheadeditor(void)
|
|||
|
||||
if (sprite[i].statnum < MAXSTATUS)
|
||||
{
|
||||
dabuffer = (char *)ExtGetSpriteCaption(i);
|
||||
dabuffer = ExtGetSpriteCaption(i);
|
||||
if (dabuffer[0] != 0)
|
||||
{
|
||||
int32_t blocking = (sprite[i].cstat&1);
|
||||
|
@ -2446,14 +2444,23 @@ void overheadeditor(void)
|
|||
drawline16base(searchx,searchy, +2,+1, +9,+1, col);
|
||||
|
||||
////// Draw the white pixel closest to mouse cursor on linehighlight
|
||||
if (linehighlight>=0 && !m32_sideview)
|
||||
if (linehighlight>=0)
|
||||
{
|
||||
getclosestpointonwall(mousxplc,mousyplc, linehighlight, &dax,&day);
|
||||
char col = wall[linehighlight].nextsector >= 0 ? editorcolors[15] : editorcolors[5];
|
||||
|
||||
if (m32_sideview)
|
||||
{
|
||||
getclosestpointonwall(searchx,searchy, linehighlight, &dax,&day, 1);
|
||||
drawline16base(dax,day, 0,0, 0,0, col);
|
||||
}
|
||||
else
|
||||
{
|
||||
getclosestpointonwall(mousxplc,mousyplc, linehighlight, &dax,&day, 0);
|
||||
x2 = mulscale14(dax-pos.x,zoom);
|
||||
y2 = mulscale14(day-pos.y,zoom);
|
||||
|
||||
drawline16base(halfxdim16+x2,midydim16+y2, 0,0, 0,0,
|
||||
wall[linehighlight].nextsector >= 0 ? editorcolors[15] : editorcolors[5]);
|
||||
drawline16base(halfxdim16+x2,midydim16+y2, 0,0, 0,0, col);
|
||||
}
|
||||
}
|
||||
|
||||
enddrawing(); //}}}
|
||||
|
@ -2887,7 +2894,7 @@ void overheadeditor(void)
|
|||
for (i=0; i<highlightsectorcnt; i++)
|
||||
for (WALLS_OF_SECTOR(highlightsector[i], j))
|
||||
{
|
||||
k = trace_loop(j, visited, NULL, NULL);
|
||||
k = trace_loop(j, visited, NULL, NULL, !cf);
|
||||
if (k == 0)
|
||||
continue;
|
||||
else if (k < 0)
|
||||
|
@ -2900,6 +2907,23 @@ void overheadeditor(void)
|
|||
numwalls = k;
|
||||
}
|
||||
|
||||
for (i=m; i<numwalls; i++) // try
|
||||
{
|
||||
j = YAX_NEXTWALL(i, !cf);
|
||||
if (j < 0)
|
||||
{
|
||||
message("Internal error while constructing sector: "
|
||||
"YAX_NEXTWALL(%d, %d)<0!", i, !cf);
|
||||
numwalls = m;
|
||||
goto end_yax;
|
||||
}
|
||||
}
|
||||
for (i=m; i<numwalls; i++) // do!
|
||||
{
|
||||
j = YAX_NEXTWALL(i, !cf);
|
||||
yax_setnextwall(j, cf, i);
|
||||
}
|
||||
|
||||
// create new sector based on first highlighted one
|
||||
i = highlightsector[0];
|
||||
Bmemcpy(§or[numsectors], §or[i], sizeof(sectortype));
|
||||
|
@ -3202,7 +3226,7 @@ end_yax: ;
|
|||
{
|
||||
for (WALLS_OF_SECTOR(highlightsector[i], j))
|
||||
{
|
||||
k = trace_loop(j, visited, &ignore, &refsect);
|
||||
k = trace_loop(j, visited, &ignore, &refsect, -1);
|
||||
if (k == 0)
|
||||
continue;
|
||||
else if (k < 0)
|
||||
|
@ -3242,6 +3266,9 @@ end_yax: ;
|
|||
if (wall[m].nextwall >= begwalltomove)
|
||||
wall[m].nextwall += n;
|
||||
}
|
||||
#ifdef YAX_ENABLE
|
||||
yax_tweakwalls(begwalltomove, n);
|
||||
#endif
|
||||
for (m=refsect+1; m<numsectors; m++)
|
||||
sector[m].wallptr += n;
|
||||
for (m=begwalltomove; m<numwalls; m++)
|
||||
|
@ -4473,6 +4500,9 @@ check_next_sector: ;
|
|||
if (wall[i].point2 >= suckwall)
|
||||
wall[i].point2 += j;
|
||||
}
|
||||
#ifdef YAX_ENABLE
|
||||
yax_tweakwalls(suckwall, j);
|
||||
#endif
|
||||
|
||||
Bmemmove(&wall[suckwall+j], &wall[suckwall], (newnumwalls-suckwall)*sizeof(walltype));
|
||||
Bmemmove(&wall[suckwall], &wall[newnumwalls], j*sizeof(walltype));
|
||||
|
@ -4962,12 +4992,32 @@ end_space_handling:
|
|||
}
|
||||
else
|
||||
{
|
||||
getclosestpointonwall(mousxplc,mousyplc, linehighlight, &dax,&day);
|
||||
adjustmark(&dax,&day, newnumwalls);
|
||||
|
||||
getclosestpointonwall(m32_sideview?searchx:mousxplc, m32_sideview?searchy:mousyplc,
|
||||
linehighlight, &dax,&day, 1);
|
||||
i = linehighlight;
|
||||
if (m32_sideview)
|
||||
{
|
||||
int32_t y_p, d, dx, dy, frac;
|
||||
|
||||
dx = dax - m32_wallscreenxy[i][0];
|
||||
dy = day - m32_wallscreenxy[i][1];
|
||||
d = max(dx, dy);
|
||||
y_p = (dy>dx);
|
||||
|
||||
if (d==0)
|
||||
goto point_not_inserted;
|
||||
|
||||
frac = divscale24(d, m32_wallscreenxy[wall[i].point2][y_p]-m32_wallscreenxy[i][y_p]);
|
||||
dax = POINT2(i).x - wall[i].x;
|
||||
day = POINT2(i).y - wall[i].y;
|
||||
dax = wall[i].x + mulscale24(dax,frac);
|
||||
day = wall[i].y + mulscale24(day,frac);
|
||||
}
|
||||
|
||||
adjustmark(&dax,&day, newnumwalls);
|
||||
if ((wall[i].x == dax && wall[i].y == day) || (POINT2(i).x == dax && POINT2(i).y == day))
|
||||
{
|
||||
point_not_inserted:
|
||||
printmessage16("Point not inserted.");
|
||||
}
|
||||
else
|
||||
|
@ -5572,6 +5622,7 @@ void getpoint(int32_t searchxe, int32_t searchye, int32_t *x, int32_t *y)
|
|||
static int32_t getlinehighlight(int32_t xplc, int32_t yplc, int32_t line)
|
||||
{
|
||||
int32_t i, dst, dist, closest, x1, y1, x2, y2, nx, ny;
|
||||
int32_t daxplc, dayplc;
|
||||
|
||||
if (numwalls == 0)
|
||||
return -1;
|
||||
|
@ -5583,11 +5634,23 @@ static int32_t getlinehighlight(int32_t xplc, int32_t yplc, int32_t line)
|
|||
return -1;
|
||||
|
||||
dist = 1024;
|
||||
if (m32_sideview)
|
||||
{
|
||||
daxplc = searchx;
|
||||
dayplc = searchy;
|
||||
dist = mulscale14(dist, zoom);
|
||||
}
|
||||
else
|
||||
{
|
||||
daxplc = xplc;
|
||||
dayplc = yplc;
|
||||
}
|
||||
|
||||
closest = -1;
|
||||
for (i=0; i<numwalls; i++)
|
||||
{
|
||||
getclosestpointonwall(xplc,yplc, i, &nx,&ny);
|
||||
dst = klabs(xplc-nx) + klabs(yplc-ny);
|
||||
getclosestpointonwall(daxplc,dayplc, i, &nx,&ny, 1);
|
||||
dst = klabs(daxplc-nx) + klabs(dayplc-ny);
|
||||
if (dst <= dist)
|
||||
{
|
||||
dist = dst;
|
||||
|
@ -5602,7 +5665,7 @@ static int32_t getlinehighlight(int32_t xplc, int32_t yplc, int32_t line)
|
|||
y1 = wall[closest].y;
|
||||
x2 = POINT2(closest).x;
|
||||
y2 = POINT2(closest).y;
|
||||
if (dmulscale32(xplc-x1,y2-y1,-(x2-x1),yplc-y1) >= 0)
|
||||
if (dmulscale32(daxplc-x1,y2-y1,-(x2-x1),dayplc-y1) >= 0)
|
||||
closest = wall[closest].nextwall;
|
||||
}
|
||||
|
||||
|
@ -5970,6 +6033,9 @@ static int32_t movewalls(int32_t start, int32_t offs)
|
|||
if (wall[i].nextwall >= start) wall[i].nextwall += offs;
|
||||
if (wall[i].point2 >= start) wall[i].point2 += offs;
|
||||
}
|
||||
#ifdef YAX_ENABLE
|
||||
yax_tweakwalls(start, offs);
|
||||
#endif
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
@ -7258,7 +7324,8 @@ void showwalldata(int16_t wallnum, int16_t small)
|
|||
|
||||
if (small)
|
||||
{
|
||||
_printmessage16("^10Wall %d %s ^O(F8 to edit)", wallnum, ExtGetWallCaption(wallnum));
|
||||
_printmessage16("^10Wall %d %s ^O(F8 to edit)", wallnum,
|
||||
ExtGetWallCaption(wallnum));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -7440,21 +7507,35 @@ void printmessage256(int32_t x, int32_t y, const char *name)
|
|||
}
|
||||
|
||||
//Find closest point (*dax, *day) on wall (dawall) to (x, y)
|
||||
static void getclosestpointonwall(int32_t x, int32_t y, int32_t dawall, int32_t *nx, int32_t *ny)
|
||||
static void getclosestpointonwall(int32_t x, int32_t y, int32_t dawall, int32_t *nx, int32_t *ny,
|
||||
int32_t maybe_screen_coord_p)
|
||||
{
|
||||
walltype *wal;
|
||||
int64_t i, j, dx, dy;
|
||||
int64_t i, j, wx,wy, wx2,wy2, dx, dy;
|
||||
|
||||
wal = &wall[dawall];
|
||||
dx = wall[wal->point2].x - wal->x;
|
||||
dy = wall[wal->point2].y - wal->y;
|
||||
i = dx*(x-wal->x) + dy*(y-wal->y);
|
||||
if (i <= 0) { *nx = wal->x; *ny = wal->y; return; }
|
||||
j = dx*dx+dy*dy;
|
||||
if (i >= j) { *nx = wal->x+dx; *ny = wal->y+dy; return; }
|
||||
if (m32_sideview && maybe_screen_coord_p)
|
||||
{
|
||||
wx = m32_wallscreenxy[dawall][0];
|
||||
wy = m32_wallscreenxy[dawall][1];
|
||||
wx2 = m32_wallscreenxy[wall[dawall].point2][0];
|
||||
wy2 = m32_wallscreenxy[wall[dawall].point2][1];
|
||||
}
|
||||
else
|
||||
{
|
||||
wx = wall[dawall].x;
|
||||
wy = wall[dawall].y;
|
||||
wx2 = POINT2(dawall).x;
|
||||
wy2 = POINT2(dawall).y;
|
||||
}
|
||||
|
||||
dx = wx2 - wx;
|
||||
dy = wy2 - wy;
|
||||
i = dx*(x-wx) + dy*(y-wy);
|
||||
if (i <= 0) { *nx = wx; *ny = wy; return; }
|
||||
j = dx*dx + dy*dy;
|
||||
if (i >= j) { *nx = wx2; *ny = wy2; return; }
|
||||
i=((i<<15)/j)<<15;
|
||||
*nx = wal->x + ((dx*i)>>30);
|
||||
*ny = wal->y + ((dy*i)>>30);
|
||||
*nx = wx + ((dx*i)>>30);
|
||||
*ny = wy + ((dy*i)>>30);
|
||||
}
|
||||
|
||||
static void initcrc(void)
|
||||
|
|
|
@ -192,8 +192,33 @@ int16_t editstatus = 0;
|
|||
|
||||
// game-time YAX data structures
|
||||
static int16_t yax_bunchnum[MAXSECTORS][2];
|
||||
static int16_t yax_nextwall[MAXWALLS][2];
|
||||
|
||||
static int32_t yax_islockededge(/*int16_t sec,*/ int16_t line, int16_t cf)
|
||||
#if 1
|
||||
{
|
||||
// UNREFERENCED_PARAMETER(sec);
|
||||
return !!(wall[line].cstat&(YAX_NEXTWALLBIT(cf)));
|
||||
}
|
||||
#else
|
||||
{
|
||||
int16_t bunchnum, nextbunch;
|
||||
int16_t ns = wall[line].nextsector;
|
||||
|
||||
bunchnum = yax_getbunch(sec, cf);
|
||||
|
||||
if (ns < 0)
|
||||
return (bunchnum >= 0);
|
||||
|
||||
nextbunch = yax_getbunch(ns, cf);
|
||||
|
||||
return (bunchnum != nextbunch);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define YAX_BUNCHNUM(Sect, Cf) (*(int16_t *)(§or[Sect].ceilingxpanning + 6*Cf))
|
||||
|
||||
//// bunch getters/setters
|
||||
int16_t yax_getbunch(int16_t i, int16_t cf)
|
||||
{
|
||||
if (editstatus==0)
|
||||
|
@ -214,7 +239,10 @@ void yax_getbunches(int16_t i, int16_t *cb, int16_t *fb)
|
|||
void yax_setbunch(int16_t i, int16_t cf, int16_t bunchnum)
|
||||
{
|
||||
if (editstatus==0)
|
||||
{
|
||||
yax_bunchnum[i][cf] = bunchnum;
|
||||
return;
|
||||
}
|
||||
|
||||
if (bunchnum<0)
|
||||
{
|
||||
|
@ -233,9 +261,38 @@ void yax_setbunches(int16_t i, int16_t cb, int16_t fb)
|
|||
yax_setbunch(i, YAX_FLOOR, fb);
|
||||
}
|
||||
|
||||
//// nextwall getters/setters
|
||||
int16_t yax_getnextwall(int16_t wal, int16_t cf)
|
||||
{
|
||||
if (editstatus==0)
|
||||
return yax_nextwall[wal][cf];
|
||||
|
||||
if (!yax_islockededge(wal, cf))
|
||||
return -1;
|
||||
|
||||
return YAX_NEXTWALL(wal, cf);
|
||||
}
|
||||
|
||||
// unchecked!
|
||||
void yax_setnextwall(int16_t wal, int16_t cf, int16_t thenextwall)
|
||||
{
|
||||
if (editstatus==0)
|
||||
{
|
||||
yax_nextwall[wal][cf] = thenextwall;
|
||||
return;
|
||||
}
|
||||
|
||||
if (thenextwall >= 0)
|
||||
wall[wal].cstat |= YAX_NEXTWALLBIT(cf);
|
||||
else
|
||||
wall[wal].cstat &= ~YAX_NEXTWALLBIT(cf);
|
||||
YAX_NEXTWALL(wal, cf) = thenextwall;
|
||||
}
|
||||
|
||||
//// in-struct --> array transfer; list construction
|
||||
void yax_update(int32_t onlyreset)
|
||||
{
|
||||
int32_t i, oeditstatus=editstatus;
|
||||
int32_t i, j, oeditstatus=editstatus;
|
||||
int16_t cb, fb, tmpsect;
|
||||
|
||||
numyaxbunches = 0;
|
||||
|
@ -247,6 +304,8 @@ void yax_update(int32_t onlyreset)
|
|||
}
|
||||
for (i=0; i<YAX_MAXBUNCHES; i++)
|
||||
headsectbunch[0][i] = headsectbunch[1][i] = -1;
|
||||
for (i=0; i<MAXWALLS; i++)
|
||||
yax_nextwall[i][0] = yax_nextwall[i][1] = -1;
|
||||
|
||||
if (onlyreset)
|
||||
return;
|
||||
|
@ -261,6 +320,12 @@ void yax_update(int32_t onlyreset)
|
|||
|
||||
if (cb >= 0)
|
||||
{
|
||||
for (j=sector[i].wallptr; j<sector[i].wallptr+sector[i].wallnum; j++)
|
||||
{
|
||||
if (yax_islockededge(j,YAX_CEILING))
|
||||
yax_nextwall[j][0] = YAX_NEXTWALL(j,0);
|
||||
}
|
||||
|
||||
if (headsectbunch[0][cb] == -1)
|
||||
{
|
||||
headsectbunch[0][cb] = i;
|
||||
|
@ -278,6 +343,12 @@ void yax_update(int32_t onlyreset)
|
|||
|
||||
if (fb >= 0)
|
||||
{
|
||||
for (j=sector[i].wallptr; j<sector[i].wallptr+sector[i].wallnum; j++)
|
||||
{
|
||||
if (yax_islockededge(j,YAX_FLOOR))
|
||||
yax_nextwall[j][1] = YAX_NEXTWALL(j,1);
|
||||
}
|
||||
|
||||
if (headsectbunch[1][fb] == -1)
|
||||
headsectbunch[1][fb] = i;
|
||||
else
|
||||
|
@ -301,8 +372,9 @@ int16_t m32_sideang = 200; // azimuth, 0..2047
|
|||
|
||||
int32_t m32_sidecos, m32_sidesin;
|
||||
int32_t m32_swcnt;
|
||||
int16_t *m32_wallsprite; // [MAXSWALLS+MAXSPRITES]
|
||||
static int32_t *m32_sidedist; // [MAXSWALLS+MAXSPRITES]
|
||||
int32_t m32_wallscreenxy[MAXWALLS][2];
|
||||
int16_t m32_wallsprite[MAXWALLS+MAXSPRITES];
|
||||
static int32_t m32_sidedist[MAXWALLS+MAXSPRITES];
|
||||
static vec3_t m32_viewplane;
|
||||
|
||||
|
||||
|
@ -12032,6 +12104,26 @@ void setfirstwall(int16_t sectnum, int16_t newfirstwall)
|
|||
|
||||
for (i=startwall; i<endwall; i++)
|
||||
if (wall[i].nextwall >= 0) wall[wall[i].nextwall].nextwall = i;
|
||||
#ifdef YAX_ENABLE
|
||||
{
|
||||
int16_t cb, fb;
|
||||
yax_getbunches(sectnum, &cb, &fb);
|
||||
|
||||
if (cb>=0 || fb>=0)
|
||||
{
|
||||
for (i=startwall; i<endwall; i++)
|
||||
{
|
||||
j = yax_getnextwall(i, YAX_CEILING);
|
||||
if (j >= 0)
|
||||
yax_setnextwall(j, YAX_FLOOR, i);
|
||||
|
||||
j = yax_getnextwall(i, YAX_FLOOR);
|
||||
if (j >= 0)
|
||||
yax_setnextwall(j, YAX_CEILING, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Bfree(tmpwall);
|
||||
}
|
||||
|
@ -12854,6 +12946,9 @@ 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]);
|
||||
}
|
||||
|
||||
m32_wallscreenxy[i][0] = halfxdim16+x1;
|
||||
m32_wallscreenxy[i][1] = midydim16+y1;
|
||||
}
|
||||
|
||||
if (wal->cstat&64) // if hitscan bit set
|
||||
|
@ -13117,18 +13212,6 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z
|
|||
if (qsetmode == 200) return;
|
||||
|
||||
setup_sideview_sincos();
|
||||
if (m32_sideview && !m32_wallsprite)
|
||||
{
|
||||
m32_wallsprite = Bmalloc((MAXWALLS+MAXSPRITES)*sizeof(int16_t));
|
||||
m32_sidedist = Bmalloc((MAXWALLS+MAXSPRITES)*sizeof(m32_sidedist[0]));
|
||||
if (!m32_wallsprite || !m32_sidedist)
|
||||
{
|
||||
if (m32_wallsprite) Bfree(m32_wallsprite);
|
||||
if (m32_sidedist) { Bfree(m32_sidedist); m32_sidedist=NULL; }
|
||||
initprintf("out of memory!");
|
||||
m32_sideview = 0;
|
||||
}
|
||||
}
|
||||
|
||||
begindrawing(); //{{{
|
||||
|
||||
|
|
|
@ -795,81 +795,36 @@ static int32_t tileInGroup(int32_t group, int32_t tilenum)
|
|||
|
||||
const char *ExtGetSectorType(int32_t lotag)
|
||||
{
|
||||
static char tempbuf[64];
|
||||
|
||||
Bmemset(tempbuf,0,sizeof(tempbuf));
|
||||
switch (lotag)
|
||||
{
|
||||
case 1:
|
||||
Bsprintf(tempbuf,"WATER (SE 7)");
|
||||
break;
|
||||
case 2:
|
||||
Bsprintf(tempbuf,"UNDERWATER (SE 7)");
|
||||
break;
|
||||
case 9:
|
||||
Bsprintf(tempbuf,"STAR TREK DOORS");
|
||||
break;
|
||||
case 15:
|
||||
Bsprintf(tempbuf,"ELEVATOR TRANSPORT (SE 17)");
|
||||
break;
|
||||
case 16:
|
||||
Bsprintf(tempbuf,"ELEVATOR PLATFORM DOWN");
|
||||
break;
|
||||
case 17:
|
||||
Bsprintf(tempbuf,"ELEVATOR PLATFORM UP");
|
||||
break;
|
||||
case 18:
|
||||
Bsprintf(tempbuf,"ELEVATOR DOWN");
|
||||
break;
|
||||
case 19:
|
||||
Bsprintf(tempbuf,"ELEVATOR UP");
|
||||
break;
|
||||
case 20:
|
||||
Bsprintf(tempbuf,"CEILING DOOR");
|
||||
break;
|
||||
case 21:
|
||||
Bsprintf(tempbuf,"FLOOR DOOR");
|
||||
break;
|
||||
case 22:
|
||||
Bsprintf(tempbuf,"SPLIT DOOR");
|
||||
break;
|
||||
case 23:
|
||||
Bsprintf(tempbuf,"SWING DOOR (SE 11)");
|
||||
break;
|
||||
case 25:
|
||||
Bsprintf(tempbuf,"SLIDE DOOR (SE 15)");
|
||||
break;
|
||||
case 26:
|
||||
Bsprintf(tempbuf,"SPLIT STAR TREK DOOR");
|
||||
break;
|
||||
case 27:
|
||||
Bsprintf(tempbuf,"BRIDGE (SE 20)");
|
||||
break;
|
||||
case 28:
|
||||
Bsprintf(tempbuf,"DROP FLOOR (SE 21)");
|
||||
break;
|
||||
case 29:
|
||||
Bsprintf(tempbuf,"TEETH DOOR (SE 22)");
|
||||
break;
|
||||
case 30:
|
||||
Bsprintf(tempbuf,"ROTATE RISE BRIDGE");
|
||||
break;
|
||||
case 31:
|
||||
Bsprintf(tempbuf,"2 WAY TRAIN (SE=30)");
|
||||
break;
|
||||
case 32767:
|
||||
Bsprintf(tempbuf,"SECRET ROOM");
|
||||
break;
|
||||
case -1:
|
||||
Bsprintf(tempbuf,"END OF LEVEL");
|
||||
break;
|
||||
default :
|
||||
case 1: return "WATER (SE 7)";
|
||||
case 2: return "UNDERWATER (SE 7)";
|
||||
case 9: return "STAR TREK DOORS";
|
||||
case 15: return "ELEVATOR TRANSPORT (SE 17)";
|
||||
case 16: return "ELEVATOR PLATFORM DOWN";
|
||||
case 17: return "ELEVATOR PLATFORM UP";
|
||||
case 18: return "ELEVATOR DOWN";
|
||||
case 19: return "ELEVATOR UP";
|
||||
case 20: return "CEILING DOOR";
|
||||
case 21: return "FLOOR DOOR";
|
||||
case 22: return "SPLIT DOOR";
|
||||
case 23: return "SWING DOOR (SE 11)";
|
||||
case 25: return "SLIDE DOOR (SE 15)";
|
||||
case 26: return "SPLIT STAR TREK DOOR";
|
||||
case 27: return "BRIDGE (SE 20)";
|
||||
case 28: return "DROP FLOOR (SE 21)";
|
||||
case 29: return "TEETH DOOR (SE 22)";
|
||||
case 30: return "ROTATE RISE BRIDGE";
|
||||
case 31: return "2 WAY TRAIN (SE=30)";
|
||||
case 32767: return "SECRET ROOM";
|
||||
case -1: return "END OF LEVEL";
|
||||
default:
|
||||
if (lotag > 10000 && lotag < 32767)
|
||||
Bsprintf(tempbuf,"1 TIME SOUND");
|
||||
// else Bsprintf(tempbuf,"%hu",lotag);
|
||||
break;
|
||||
return "1 TIME SOUND";
|
||||
// else Bsprintf(tempbuf,"%hu",lotag);
|
||||
}
|
||||
return(tempbuf);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
const char *ExtGetSectorCaption(int16_t sectnum)
|
||||
|
@ -916,7 +871,19 @@ const char *ExtGetWallCaption(int16_t wallnum)
|
|||
if ((wall[wallnum].lotag|wall[wallnum].hitag) == 0)
|
||||
tempbuf[0] = 0;
|
||||
else
|
||||
{
|
||||
#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);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
Bsprintf(tempbuf, "%hu,%hu", wall[wallnum].hitag, wall[wallnum].lotag);
|
||||
}
|
||||
|
||||
return(tempbuf);
|
||||
} //end
|
||||
|
@ -1104,8 +1071,7 @@ void ExtShowSectorData(int16_t sectnum) //F5
|
|||
for (i=0; i<numsectors; i++)
|
||||
secrets += (sector[i].lotag==32767);
|
||||
|
||||
i = headspritestat[0];
|
||||
while (i != -1)
|
||||
for (i=headspritestat[0]; i != -1; i=nextspritestat[i])
|
||||
{
|
||||
// Count all non-player actors.
|
||||
if (tileInGroup(tilegroupActors, sprite[i].picnum))
|
||||
|
@ -1118,8 +1084,6 @@ void ExtShowSectorData(int16_t sectnum) //F5
|
|||
|
||||
if (sprite[i].picnum == RESPAWN)
|
||||
totalrespawn++;
|
||||
|
||||
i = nextspritestat[i];
|
||||
}
|
||||
|
||||
Bmemset(numsprite, 0, sizeof(numsprite));
|
||||
|
@ -1613,7 +1577,6 @@ static void ReadHelpFile(const char *name)
|
|||
return;
|
||||
|
||||
HELPFILE_ERROR:
|
||||
|
||||
Bfclose(fp);
|
||||
initprintf("ReadHelpFile(): ERROR allocating memory.\n");
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue