diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 369d5a98d..37a53cd9e 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -66,7 +66,7 @@ extern "C" { #define YAX_CEILING 0 #define YAX_FLOOR 1 -#define YAX_SECTORFLD(Sect,Fld, Cf) (*((uint8_t *)§or[Sect].ceiling##Fld + (Cf)*((char*)§or[0].floor##Fld - (char*)§or[0].ceiling##Fld))) +#define YAX_SECTORFLD(Sect,Fld, Cf) (*((Cf) ? (§or[Sect].floor##Fld) : (§or[Sect].ceiling##Fld))) int16_t yax_getbunch(int16_t i, int16_t cf); void yax_setbunch(int16_t i, int16_t cf, int16_t bunchnum); diff --git a/polymer/eduke32/build/include/editor.h b/polymer/eduke32/build/include/editor.h index e7cef41ef..1d4399633 100644 --- a/polymer/eduke32/build/include/editor.h +++ b/polymer/eduke32/build/include/editor.h @@ -160,6 +160,9 @@ int32_t getpointhighlight(int32_t xplc, int32_t yplc, int32_t point); void update_highlight(); void update_highlightsector(); +int32_t inside_editor(const vec3_t *pos, int32_t searchx, int32_t searchy, int32_t zoom, + int32_t x, int32_t y, int16_t sectnum); + extern uint8_t hlsectorbitmap[MAXSECTORS>>3]; #ifdef _WIN32 diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 40f003f72..43c6fe553 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -154,6 +154,8 @@ static int32_t mousx, mousy; int16_t prefixtiles[16] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; uint8_t hlsectorbitmap[MAXSECTORS>>3]; // show2dsector is already taken... +static uint8_t visited[MAXWALLS>>3]; // used for AlignWalls and trace_loop + typedef struct { int16_t numsectors, numwalls, numsprites; @@ -748,13 +750,13 @@ void editinput(void) ldiv_t ld; if (mlook) { - ld = ldiv((int32_t)(mousx), (int32_t)((1<<16)/(msens*0.5f))); mousx = ld.quot; mousexsurp = ld.rem; - ld = ldiv((int32_t)(mousy), (int32_t)((1<<16)/(msens*0.25f))); mousy = ld.quot; mouseysurp = ld.rem; + ld = ldiv((int32_t)mousx, (int32_t)((1<<16)/(msens*0.5f))); mousx = ld.quot; mousexsurp = ld.rem; + ld = ldiv((int32_t)mousy, (int32_t)((1<<16)/(msens*0.25f))); mousy = ld.quot; mouseysurp = ld.rem; } else { - ld = ldiv((int32_t)(mousx), (int32_t)((1<<16)/msens)); mousx = ld.quot; mousexsurp = ld.rem; - ld = ldiv((int32_t)(mousy), (int32_t)((1<<16)/msens)); mousy = ld.quot; mouseysurp = ld.rem; + ld = ldiv((int32_t)mousx, (int32_t)((1<<16)/msens)); mousx = ld.quot; mousexsurp = ld.rem; + ld = ldiv((int32_t)mousy, (int32_t)((1<<16)/msens)); mousy = ld.quot; mouseysurp = ld.rem; } } @@ -880,7 +882,7 @@ void editinput(void) if (mhk) { Bmemset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES); - Bmemset(spritesmooth, 0, sizeof(spritesmooth_t) *(MAXSPRITES+MAXUNIQHUDID)); + Bmemset(spritesmooth, 0, sizeof(spritesmooth_t) * (MAXSPRITES+MAXUNIQHUDID)); delete_maphack_lights(); mhk = 0; message("Maphacks disabled"); @@ -1045,6 +1047,8 @@ void editinput(void) hvel = 0; } + updatesectorz(pos.x,pos.y,pos.z, &cursectnum); + searchit = 2; if (searchstat >= 0) { @@ -1239,6 +1243,43 @@ char changechar(char dachar, int32_t dadir, char smooshyalign, char boundcheck) ////////////////////// OVERHEADEDITOR ////////////////////// +int32_t inside_editor(const vec3_t *pos, int32_t searchx, int32_t searchy, int32_t zoom, + int32_t x, int32_t y, int16_t sectnum) +{ + if (!m32_sideview) + return inside(x, y, sectnum); + + // if in side-view mode, use the screen coords instead + { + int32_t dst = MAXSECTORS+M32_FIXME_SECTORS-1, i, oi; + int32_t srcw=sector[sectnum].wallptr, dstw=MAXWALLS; + int32_t ret; + + if (sector[sectnum].wallnum > M32_FIXME_WALLS) + return -1; + + Bmemcpy(§or[dst], §or[sectnum], sizeof(sectortype)); + sector[dst].wallptr = dstw; + + Bmemcpy(&wall[dstw], &wall[srcw], sector[dst].wallnum*sizeof(walltype)); + for (i=dstw, oi=srcw; ix, wall[i].y-pos->y, zoom); + wall[i].y += getscreenvdisp(getflorzofslope(sectnum,wall[oi].x,wall[oi].y)-pos->z, zoom); + wall[i].x += halfxdim16; + wall[i].y += midydim16; + } + + i = numsectors; + numsectors = dst+1; + ret = inside(searchx, searchy, dst); + numsectors = i; + return ret; + } +} + static inline void drawline16base(int32_t bx, int32_t by, int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col) { drawline16(bx+x1, by+y1, bx+x2, by+y2, col); @@ -1657,7 +1698,7 @@ static void sideview_filter_keys(void) { case 0xd2: case 0xd3: // ins, del case 0x2e: case 0x39: // c, space - case 0xb8: // ralt +// case 0xb8: // ralt keystatus[i] = 0; break; } @@ -1889,10 +1930,11 @@ static int32_t trace_loop(int32_t j, uint8_t *visitedwall, int16_t *ignore_ret, } if (ignore_ret) + { *ignore_ret = ignore; - - if (refsect_ret) - *refsect_ret = refsect; + if (refsect_ret) + *refsect_ret = refsect; + } return k; } @@ -2226,10 +2268,7 @@ void overheadeditor(void) if (dabuffer[0] != 0) { //Get average point of sprite - dax = sprite[i].x; - day = sprite[i].y; - - screencoords(&dax,&day, dax-pos.x,day-pos.y, zoom); + screencoords(&dax,&day, sprite[i].x-pos.x,sprite[i].y-pos.y, zoom); if (m32_sideview) day += getscreenvdisp(sprite[i].z-pos.z, zoom); @@ -2256,7 +2295,7 @@ void overheadeditor(void) numwalls = tempint; - if (highlightsectorcnt >= 0 && !m32_sideview) + if (highlightsectorcnt >= 0) for (i=0; i>3]&(1<<(i&7))) fillsector(i,2); @@ -2319,6 +2358,9 @@ void overheadeditor(void) if (keystatus[0x28]) drawline16base(searchx+16, searchy-16, 0,-4, 0,+4, col); } + + if (keystatus[0x36] && eitherCTRL) + printext16(searchx+6,searchy-6-8,editorcolors[12],-1,"S",0); } drawline16base(searchx,searchy, +0,-8, +0,-1, col); @@ -2659,7 +2701,7 @@ void overheadeditor(void) keystatus[0x41] = 0; for (i=0; i 0&&0) + else if (highlightsectorcnt > 0 && newnumwalls < 0&&0) { ////////// YAX ////////// static const char *cfs[2] = {"ceiling", "floor"}; - int32_t cf, good, thez; + int32_t cf, thez; cf = ask_above_or_below(); - if (!cf) + if (cf==-1) 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= 0) + { + message("Sector %d's %s is already extended", highlightsector[i], cfs[cf]); + goto end_yax; + } + + if (i==0) + continue; + if (YAX_SECTORFLD(highlightsector[i],z, cf) != thez) { message("All sectors must have the same %s height", cfs[cf]); @@ -2800,6 +2847,73 @@ void overheadeditor(void) goto end_yax; } } + + m = numwalls; + Bmemset(visited, 0, sizeof(visited)); + // construct! + for (i=0; i highlightx2) swaplong(&highlightx1, &highlightx2); @@ -2842,7 +2959,7 @@ end_yax: ; swaplong(&highlighty1, &highlighty2); // Ctrl+RShift: select all wall-points of highlighted wall's loop: - if (eitherCTRL) + if (eitherCTRL && highlightx1==highlightx2 && highlighty1==highlighty2) { Bmemset(show2dwall, 0, sizeof(show2dwall)); Bmemset(show2dsprite, 0, sizeof(show2dsprite)); @@ -2868,6 +2985,7 @@ end_yax: ; else { int32_t add=keystatus[0x28], sub=(!add && keystatus[0x27]), setop=(add||sub); + int32_t tx, ty, onlySprites=eitherCTRL; if (!setop) { @@ -2876,19 +2994,81 @@ end_yax: ; } for (i=0; i= highlightx1 && wall[i].x <= highlightx2 && - wall[i].y >= highlighty1 && wall[i].y <= highlighty2) + { + if (onlySprites) + break; + + if (!m32_sideview) + { + tx = wall[i].x; + ty = wall[i].y; + wall[i].cstat &= ~(1<<14); + } + else + { + screencoords(&tx,&ty, wall[i].x-pos.x,wall[i].y-pos.y, zoom); + ty += getscreenvdisp( + getflorzofslope(sectorofwall(i), wall[i].x,wall[i].y)-pos.z, zoom); + tx += halfxdim16; + ty += midydim16; + } + + if (tx >= highlightx1 && tx <= highlightx2 && + ty >= highlighty1 && ty <= highlighty2) { if (!sub) show2dwall[i>>3] |= (1<<(i&7)); else if (sub) show2dwall[i>>3] &= ~(1<<(i&7)); } + } + + if (m32_sideview && !onlySprites) + { + // also select walls that would be dragged but + // maybe were missed +#if 1 + for (i=0; i>3]&(1<<(i&7))) + { + //N^2...ugh + for (j=0; j>3] |= (1<<(j&7)); + } +#else + for (i=0; i>3]&(1<<(i&7))) + dragpoint(i, wall[i].x, wall[i].y); + for (i=0; i>3] |= (1<<(i&7)); + wall[i].cstat &= ~(1<<14); + } +#endif + } for (i=0; i= highlightx1 && sprite[i].x <= highlightx2 && - sprite[i].y >= highlighty1 && sprite[i].y <= highlighty2) + { + if (sprite[i].statnum == MAXSTATUS) + continue; + + if (!m32_sideview) + { + tx = sprite[i].x; + ty = sprite[i].y; + } + else + { + screencoords(&tx,&ty, sprite[i].x-pos.x,sprite[i].y-pos.y, zoom); + ty += getscreenvdisp(sprite[i].z-pos.z, zoom); + tx += halfxdim16; + ty += midydim16; + } + + if (tx >= highlightx1 && tx <= highlightx2 && + ty >= highlighty1 && ty <= highlighty2) { if (!sub) { @@ -2898,6 +3078,7 @@ end_yax: ; else show2dsprite[i>>3] &= ~(1<<(i&7)); } + } update_highlight(); } @@ -2956,25 +3137,23 @@ end_yax: ; if (!didmakered && !hadouterpoint && newnumwalls<0) { - uint8_t *visitedwall = Bcalloc((numwalls+7)>>3,1); int16_t ignore, refsect; int32_t n; - if (!visitedwall) - { - message("out of memory!"); - goto outtathis; - } + Bmemset(visited, 0, sizeof(visited)); for (i=0; i highlightx2) bad = 1; - if (wall[j].y < highlighty1) bad = 1; - if (wall[j].y > highlighty2) bad = 1; + if (!m32_sideview) + { + tx = wall[j].x; + ty = wall[j].y; + } + else + { + screencoords(&tx,&ty, wall[j].x-pos.x,wall[j].y-pos.y, zoom); + ty += getscreenvdisp(getflorzofslope(i, wall[j].x,wall[j].y)-pos.z, zoom); + tx += halfxdim16; + ty += midydim16; + } + + if (tx < highlightx1 || tx > highlightx2) bad = 1; + if (ty < highlighty1 || ty > highlighty2) bad = 1; if (bad == 1) break; } } @@ -3103,8 +3294,8 @@ outtathis: update_highlightsector(); ovh_whiteoutgrab(); - if (highlightsectorcnt>0) - printmessage16("Total selected sectors: %d", highlightsectorcnt); +// if (highlightsectorcnt>0) +// printmessage16("Total selected sectors: %d", highlightsectorcnt); } } } @@ -3218,7 +3409,7 @@ end_after_dragging: // updatesector(mousxplc,mousyplc,&cursectorhighlight); cursectorhighlight = -1; for (i=0; i>14); - y2 = midydim16 + (((POINT2(z).y-pos.y)*zoom)>>14); + screencoords(&x1,&y1, wall[z].x-pos.x,wall[z].y-pos.y, zoom); + if (m32_sideview) + y1 += getscreenvdisp(getflorzofslope(sectnum,wall[z].x,wall[z].y)-pos.z, zoom); - miny = min(miny, min(y1, y2)); - maxy = max(maxy, max(y1, y2)); + x1 += halfxdim16; + y1 += midydim16; + + if (m32_sideview) + { + fillsectorxy[z][0] = x1; + fillsectorxy[z][1] = y1; + } + + miny = min(miny, y1); + maxy = max(maxy, y1); } if (miny < uborder) miny = uborder; @@ -6455,24 +6658,52 @@ int32_t fillsector(int16_t sectnum, char fillcolor) fillist[0] = lborder; fillcnt = 1; for (z=startwall; z<=endwall; z++) { - x1 = wall[z].x; x2 = POINT2(z).x; - y1 = wall[z].y; y2 = POINT2(z).y; - if (y1 > y2) + if (m32_sideview) { - swaplong(&x1, &x2); - swaplong(&y1, &y2); + x1 = fillsectorxy[z][0]; + y1 = fillsectorxy[z][1]; + x2 = fillsectorxy[wall[z].point2][0]; + y2 = fillsectorxy[wall[z].point2][1]; + + if (y1 > y2) + { + swaplong(&x1, &x2); + swaplong(&y1, &y2); + } + + if (y1 <= sy && sy < y2) + { + if (fillcnt == sizeof(fillist)/sizeof(fillist[0])) + break; + + x1 += scale(sy-y1, x2-x1, y2-y1); + fillist[fillcnt++] = x1; + } } - - if (y1 <= y && y < y2) - //if (x1*(y-y2) + x2*(y1-y) <= 0) + else { - if (fillcnt == sizeof(fillist)/sizeof(fillist[0])) - break; + x1 = wall[z].x; x2 = POINT2(z).x; + y1 = wall[z].y; y2 = POINT2(z).y; - dax = x1 + scale(y-y1, x2-x1, y2-y1); - dax = halfxdim16 + (((dax-pos.x)*zoom)>>14); - if (dax >= lborder) - fillist[fillcnt++] = dax; + if (y1 > y2) + { + swaplong(&x1, &x2); + swaplong(&y1, &y2); + } + + if (y1 <= y && y < y2) + //if (x1*(y-y2) + x2*(y1-y) <= 0) + { + dax = x1 + scale(y-y1, x2-x1, y2-y1); + dax = halfxdim16 + (((dax-pos.x)*zoom)>>14); + if (dax >= lborder) + { + if (fillcnt == sizeof(fillist)/sizeof(fillist[0])) + break; + + fillist[fillcnt++] = dax; + } + } } } @@ -6681,7 +6912,8 @@ badline: void printcoords16(int32_t posxe, int32_t posye, int16_t ange) { char snotbuf[80]; - int32_t i,m; + int32_t i, m; + int32_t v8 = (numsectors > MAXSECTORSV7 || numwalls > MAXWALLSV7 || numsprites > MAXSPRITESV7); Bsprintf(snotbuf,"x:%d y:%d ang:%d r%d",posxe,posye,ange,map_revision-1); i = 0; @@ -6698,24 +6930,44 @@ void printcoords16(int32_t posxe, int32_t posye, int16_t ange) printext16(8, ydim-STATUS2DSIZ+128, whitecol, -1, snotbuf,0); - m = (numsectors > MAXSECTORSV7 || numwalls > MAXWALLSV7 || numsprites > MAXSPRITESV7); + if (highlightcnt<=0 && highlightsectorcnt<=0) + { + Bsprintf(snotbuf,"%d/%d sect. %d/%d walls %d/%d spri.", + numsectors, v8?MAXSECTORSV8:MAXSECTORSV7, + numwalls, v8?MAXWALLSV8:MAXWALLSV7, + numsprites, v8?MAXSPRITESV8:MAXSPRITESV7); + } + else + { + if (highlightcnt>0) + { + m = 0; + for (i=0; i0) + Bsprintf(snotbuf, "%d sectors selected", highlightsectorcnt); + else + snotbuf[0] = 0; - Bsprintf(snotbuf,"%d/%d sect. %d/%d walls %d/%d spri.", - numsectors, m?MAXSECTORSV8:MAXSECTORSV7, - numwalls, m?MAXWALLSV8:MAXWALLSV7, - numsprites, m?MAXSPRITESV8:MAXSPRITESV7); + v8 = 1; + } + + m = xdim/8 - 264/8; + m = clamp(m, 1, (signed)sizeof(snotbuf)-1); i = 0; - while ((snotbuf[i] != 0) && (i < 46)) + while (snotbuf[i] && i < m) i++; - while (i < 46) + while (i < m) { snotbuf[i] = 32; i++; } - snotbuf[46] = 0; + snotbuf[m] = 0; - printext16(264, ydim-STATUS2DSIZ+128, m?editorcolors[10]:whitecol, -1, snotbuf,0); + printext16(264, ydim-STATUS2DSIZ+128, v8?editorcolors[10]:whitecol, -1, snotbuf,0); } void updatenumsprites(void) @@ -7101,8 +7353,6 @@ static void initcrc(void) } } -static char visited[MAXWALLS]; - static int32_t GetWallZPeg(int32_t nWall) { int32_t z=0, nSector, nNextSector; @@ -7156,8 +7406,8 @@ void AutoAlignWalls(int32_t nWall0, int32_t ply) if (ply == 0) { //clear visited bits - Bmemset(visited,0,sizeof(visited)); - visited[nWall0] = 1; + Bmemset(visited, 0, sizeof(visited)); + visited[nWall0>>3] |= (1<<(nWall0&7)); } z0 = GetWallZPeg(nWall0); @@ -7168,12 +7418,14 @@ void AutoAlignWalls(int32_t nWall0, int32_t ply) while (1) { //break if this wall would connect us in a loop - if (visited[nWall1]) break; + if (visited[nWall1>>3]&(1<<(nWall1&7))) + break; - visited[nWall1] = 1; + visited[nWall1>>3] |= (1<<(nWall1&7)); //break if reached back of left wall - if (wall[nWall1].nextwall == nWall0) break; + if (wall[nWall1].nextwall == nWall0) + break; if (wall[nWall1].picnum == nTile) { diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index e1b9f628c..b3bdddb71 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -169,6 +169,10 @@ static int16_t maphacklightcnt=0; static int16_t maphacklight[PR_MAXLIGHTS]; #endif +// forward refs +inline int32_t getscreenvdisp(int32_t bz, int32_t zoome); +void screencoords(int32_t *xres, int32_t *yres, int32_t x, int32_t y, int32_t zoome); + ////////// YAX ////////// #define YAX_BUNCHNUM(Sect, Cf) (*(int16_t *)(§or[Sect].ceilingxpanning + 6*Cf)) @@ -777,7 +781,7 @@ int32_t checksectorpointer(int16_t i, int16_t sectnum) 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 (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. @@ -12580,7 +12584,8 @@ void draw2dgrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum, static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t posze, int32_t zoome) { const walltype *wal = &wall[i]; - int32_t j, x1, y1, x2, y2, dz = 0, dz2 = 0; + int32_t sect=0, j, x1, y1, x2, y2, dz = 0, dz2 = 0; + int32_t fz=0,fzn=0; // intptr_t tempint; char col; @@ -12610,7 +12615,7 @@ static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t col = 33; if ((wal->cstat&1) != 0) col = 5; - if (wal->nextwall >= 0 && ((wal->cstat^wall[wal->nextwall].cstat)&1)) + if (wal->nextwall >= 0 && ((wal->cstat^wall[j].cstat)&1)) col = 2; if ((i == linehighlight) || ((linehighlight >= 0) && (i == wall[linehighlight].nextwall))) if (totalclock & 16) @@ -12624,7 +12629,7 @@ static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t dy = wal->y-wall[wal->point2].y; dist = dx*dx+dy*dy; - if (dist > 0xffffffff) + if (dist > 0xffffffffll) { col=9; if (i == linehighlight || ((linehighlight >= 0) && (i == wall[linehighlight].nextwall))) @@ -12642,8 +12647,8 @@ static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t if (m32_sideview) { // draw vertical line to neighboring wall - int32_t fz, fz2, fzn; - int32_t sect=sectorofwall(i); + int32_t fz2; + sect = sectorofwall(i); fz = getflorzofslope(sect, wal->x,wal->y); fz2 = getflorzofslope(sect, wall[wal->point2].x,wall[wal->point2].y); @@ -12656,12 +12661,13 @@ static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t if (wal->nextwall>=0) { - fzn = getflorzofslope(wal->nextsector, wal->x,wal->y)-fz; - drawline16mid(x1,y1, x1,y1+getscreenvdisp(fzn,zoome), editorcolors[col]); + fzn = getflorzofslope(wal->nextsector, wal->x,wal->y); +// if (i < wall[j].point2) + drawline16mid(x1,y1, x1,y1+getscreenvdisp(fzn-fz,zoome), editorcolors[col]); } } - if ((wal->cstat&64) > 0) // if hitscan bit set + if (wal->cstat&64) // if hitscan bit set { int32_t one=(klabs(x2-x1) >= klabs(y2-y1)), no=!one; @@ -12698,18 +12704,11 @@ static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t drawline16mid(dax+dax3,day+day3, dax+dax2,day+day2, editorcolors[col]); } - else if (jj > ii) + else { - int32_t dax2 = mulscale11(sintable[(k+1024)&2047],zoome) / 2560; - int32_t day2 = mulscale11(sintable[(k+512)&2047],zoome) / 2560; - - day2 = scalescreeny(day2); - drawline16mid(dax,day, dax+dax2,day+day2, editorcolors[col]); - } - else if (jj < ii) - { - int32_t dax2 = mulscale11(sintable[(k+2048)&2047],zoome) / 2560; - int32_t day2 = mulscale11(sintable[(k+1536)&2047],zoome) / 2560; + int32_t bb = (jj < ii); + int32_t dax2 = mulscale11(sintable[(k+1024 + 1024*bb)&2047],zoome) / 2560; + int32_t day2 = mulscale11(sintable[(k+512 + 1024*bb)&2047],zoome) / 2560; day2 = scalescreeny(day2); drawline16mid(dax,day, dax+dax2,day+day2, editorcolors[col]); @@ -12749,15 +12748,11 @@ static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t col = 15; if (m32_sideview) { - int16_t nw = wall[i].nextwall; - if (nw>=0) + if (wal->nextwall >= 0) { - int32_t fz = getflorzofslope(sectorofwall(i), wall[i].x, wall[i].y); - int32_t fz2 = getflorzofslope(wall[i].nextsector, wall[i].x, wall[i].y); - - if (fz < fz2) + if (fz < fzn) col = 7; - else if (fz==fz2) + else if (fz == fzn) col = 4; } } diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index e391a8cab..29cb2b97a 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -4427,6 +4427,9 @@ static void Keys3d(void) if (getmessageleng) break; + if (sprite[searchwall].picnum<0 || sprite[searchwall].picnum>=MAXTILES) + break; + if (names[sprite[searchwall].picnum][0]) { if (sprite[searchwall].picnum==SECTOREFFECTOR) @@ -5545,7 +5548,7 @@ static void Keys3d(void) if (ASSERT_AIMING) { - message("%ss with picnum %d have shade of %d", Typestr[searchstat], temppicnum, tempshade); + message("%ss with picnum %d now have shade of %d", Typestr[searchstat], temppicnum, tempshade); asksave = 1; } } @@ -6661,7 +6664,7 @@ static void Keys2d(void) tcursectornum = -1; for (i=0; i