From 958c20762218c6f0886b0525aed2efb99e2f42c1 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Fri, 25 Mar 2011 11:42:07 +0000 Subject: [PATCH] editor and makefile tweaks git-svn-id: https://svn.eduke32.com/eduke32@1856 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/Makefile.common | 6 ++ polymer/eduke32/build/src/build.c | 41 ++++++++-- polymer/eduke32/build/src/engine.c | 122 ++++++++++++++++++++++++----- polymer/eduke32/source/astub.c | 10 +-- 4 files changed, 149 insertions(+), 30 deletions(-) diff --git a/polymer/eduke32/Makefile.common b/polymer/eduke32/Makefile.common index ffd7efcf6..ba951bfc7 100644 --- a/polymer/eduke32/Makefile.common +++ b/polymer/eduke32/Makefile.common @@ -36,6 +36,7 @@ endif # KRANDDEBUG - 1 = include logging of krand() calls for debugging the demo system # EFENCE - 1 = compile with Electric Fence for malloc() debugging # OPTLEVEL - 0..3 = GCC optimization strategy +# LTO - 1 = enable link-time optimization, for GCC 4.5 and up # RELEASE?=1 DEBUGANYWAY?=0 @@ -44,6 +45,7 @@ EFENCE?=0 OPTLEVEL?=2 PROFILER?=0 MUDFLAP?=0 +LTO?=0 ifneq (0,$(KRANDDEBUG)) RELEASE=0 @@ -71,6 +73,10 @@ endif ifneq (0,$(RELEASE)) # Debugging disabled debug=-fomit-frame-pointer -funswitch-loops -O$(OPTLEVEL) + ifneq (0,$(LTO)) + LIBS+= -flto + debug+= -flto + endif else # Debugging enabled debug=-ggdb -O0 -DDEBUGGINGAIDS diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 3cb379d36..268dd8b2c 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -363,7 +363,7 @@ static void yax_resetbunchnums(void) for (i=0; i=0 || fb>=0); yax_getbunches(ns, &cbn, &fbn); - return (cb==cbn && fb==fbn); + 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= 0) { #ifdef YAX_ENABLE - if (!yax_isinnerwall(sectorofwall(linehighlight), linehighlight)) + if (yax_islockedwall(sectorofwall(linehighlight), linehighlight)) printmessage16("Can't make circle in wall constrained by sector extension."); else #endif @@ -4948,8 +4972,11 @@ end_space_handling: else { #ifdef YAX_ENABLE - if (!yax_isinnerwall(sectorofwall(linehighlight), linehighlight)) + int32_t sec = sectorofwall(linehighlight); + if (yax_islockedwall(sec, linehighlight)) + { printmessage16("Inserting point in constrained wall: not implemented!"); + } else #endif { diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 801ce0354..3ad7c556e 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -9957,6 +9957,7 @@ static int32_t clipsprite_initindex(int32_t curidx, spritetype *curspr, int32_t clipsectorlist[clipsectnum++] = j; } + // add outer sector if not inside inner ones if (clipsectnum==0) clipsectorlist[clipsectnum++] = sectq[k-1]; @@ -10762,6 +10763,7 @@ int32_t krand(void) // // getzrange // + void getzrange(const vec3_t *vect, int16_t sectnum, int32_t *ceilz, int32_t *ceilhit, int32_t *florz, int32_t *florhit, int32_t walldist, uint32_t cliptype) @@ -10776,6 +10778,10 @@ void getzrange(const vec3_t *vect, int16_t sectnum, int16_t cstat; char clipyou; +#ifdef YAX_ENABLE + // YAX round, -1:center, 0:ceiling, 1:floor + int32_t mcf=-1; +#endif spritetype *curspr=NULL; // non-NULL when handling sprite with sector-like clipping int32_t curidx=-1, clipspritecnt; @@ -10810,11 +10816,14 @@ beginagain: clipsectcnt = clipsectnum; // should be a nop, "safety"... } +#ifdef YAX_ENABLE +restart_grand: +#endif do //Collect sectors inside your square first { if (clipsectcnt>=clipsectnum) { - // one bunch of sectors completed, prepare the next + // one set of clip-sprite sectors completed, prepare the next curspr = &sprite[clipspritelist[clipspritecnt]]; @@ -10828,6 +10837,7 @@ beginagain: if (curidx < 0) { + // didn't find matching clipping sectors for sprite clipspritecnt++; continue; } @@ -10836,7 +10846,7 @@ beginagain: for (i=0; ix,vect->y,&daz,&daz2); getzsofslope(sectq[clipinfo[curidx].qend],vect->x,vect->y,&cz,&fz); + hitwhat = (curspr-sprite)+49152; if ((sector[k].ceilingstat&1)==0) { - if (vect->z < cz && cz < *florz) { *florz = cz; *florhit = (curspr-sprite)+49152; } - if (vect->z > daz && daz > *ceilz) { *ceilz = daz; *ceilhit = (curspr-sprite)+49152; } + if (vect->z < cz && cz < *florz) { *florz = cz; *florhit = hitwhat; } + if (vect->z > daz && daz > *ceilz) { *ceilz = daz; *ceilhit = hitwhat; } } if ((sector[k].floorstat&1)==0) { - if (vect->z < daz2 && daz2 < *florz) { *florz = daz2; *florhit = (curspr-sprite)+49152; } - if (vect->z > fz && fz > *ceilz) { *ceilz = fz; *ceilhit = (curspr-sprite)+49152; } + if (vect->z < daz2 && daz2 < *florz) { *florz = daz2; *florhit = hitwhat; } + if (vect->z > fz && fz > *ceilz) { *ceilz = fz; *ceilhit = hitwhat; } } } } @@ -10895,7 +10906,8 @@ beginagain: if (((sec->floorstat&1) == 0) && (vect->z >= sec->floorz-(3<<8))) continue; } - for (i=clipsectnum-1; i>=0; i--) if (clipsectorlist[i] == k) break; + for (i=clipsectnum-1; i>=0; i--) + if (clipsectorlist[i] == k) break; if (i < 0) clipsectorlist[clipsectnum++] = k; if ((x1 < xmin+MAXCLIPDIST) && (x2 < xmin+MAXCLIPDIST)) continue; @@ -10907,27 +10919,40 @@ beginagain: if (dax >= day) continue; //It actually got here, through all the continue's!!! - getzsofslope((int16_t)k,vect->x,vect->y,&daz,&daz2); + getzsofslope(k, vect->x,vect->y, &daz,&daz2); if (curspr) { - int32_t fz,cz; + int32_t fz,cz, hitwhat=(curspr-sprite)+49152; getzsofslope(sectq[clipinfo[curidx].qend],vect->x,vect->y,&cz,&fz); if ((sec->ceilingstat&1)==0) { - if (vect->z < cz && cz < *florz) { *florz = cz; *florhit = (curspr-sprite)+49152; } - if (vect->z > daz && daz > *ceilz) { *ceilz = daz; *ceilhit = (curspr-sprite)+49152; } + if (vect->z < cz && cz < *florz) { *florz = cz; *florhit = hitwhat; } + if (vect->z > daz && daz > *ceilz) { *ceilz = daz; *ceilhit = hitwhat; } } if ((sec->floorstat&1)==0) { - if (vect->z < daz2 && daz2 < *florz) { *florz = daz2; *florhit = (curspr-sprite)+49152; } - if (vect->z > fz && fz > *ceilz) { *ceilz = fz; *ceilhit = (curspr-sprite)+49152; } + if (vect->z < daz2 && daz2 < *florz) { *florz = daz2; *florhit = hitwhat; } + if (vect->z > fz && fz > *ceilz) { *ceilz = fz; *ceilhit = hitwhat; } } } else { - if (daz > *ceilz) { *ceilz = daz; *ceilhit = k+16384; } - if (daz2 < *florz) { *florz = daz2; *florhit = k+16384; } +#ifdef YAX_ENABLE + int16_t cb, fb; + yax_getbunches(k, &cb, &fb); +#endif + if (daz > *ceilz) +#ifdef YAX_ENABLE + if (mcf!=YAX_FLOOR && cb < 0) +#endif + *ceilz = daz, *ceilhit = k+16384; + + if (daz2 < *florz) +#ifdef YAX_ENABLE + if (mcf!=YAX_CEILING && fb < 0) +#endif + *florz = daz2, *florhit = k+16384; } } } @@ -10938,7 +10963,7 @@ beginagain: if (curspr) { mapinfo_set(NULL, &origmapinfo); // restore original map - return; + clipsectnum = clipspritenum = 0; // skip the next for loop and check afterwards } for (i=0; iz; k = ((tilesizy[spr->picnum]*spr->yrepeat)<<1); if (cstat&128) daz += k; - if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2); + if (picanm[spr->picnum]&0x00ff0000) + daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2); daz2 = daz - (k<<1); clipyou = 1; } @@ -10982,7 +11008,8 @@ beginagain: { daz = spr->z; k = ((tilesizy[spr->picnum]*spr->yrepeat)<<1); if (cstat&128) daz += k; - if (picanm[spr->picnum]&0x00ff0000) daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2); + if (picanm[spr->picnum]&0x00ff0000) + daz -= ((int32_t)((int8_t)((picanm[spr->picnum]>>16)&255))*spr->yrepeat<<2); daz2 = daz-(k<<1); clipyou = 1; } @@ -11053,6 +11080,65 @@ beginagain: if (clipspritenum>0) goto beginagain; + +#ifdef YAX_ENABLE + if (numyaxbunches > 0) + { + int16_t cb, fb, didchange; + yax_getbunches(sectnum, &cb, &fb); + + if (mcf==-1) + { + Bmemcpy(origclipsectorlist, clipsectorlist, clipsectnum*sizeof(clipsectorlist[0])); + origclipsectnum = clipsectnum; + } + + mcf++; + clipsectcnt = 0; clipsectnum = 0; + clipspritecnt = 0; clipspritenum = 0; + didchange = 0; + + if (cb>=0 && mcf==0 && *ceilhit==sectnum+16384) + { + for (i=0; ix,vect->y, j)==1) + { + clipsectorlist[clipsectnum++] = j; + daz = getceilzofslope(j, vect->x,vect->y); + if (!didchange || daz > *ceilz) + didchange=1, *ceilhit = j+16384, *ceilz = daz; + } + } + + if (clipsectnum==0) + mcf++; + } + else mcf++; + + if (fb>=0 && mcf==1 && *florhit==sectnum+16384) + { + // (almost) same as above, but with floors... + for (i=0; ix,vect->y, j)==1) + { + clipsectorlist[clipsectnum++] = j; + daz = getflorzofslope(j, vect->x,vect->y); + if (!didchange || daz < *florz) + didchange=1, *florhit = j+16384, *florz = daz; + } + } + } + + if (clipsectnum > 0) + goto restart_grand; + } +#endif } void setaspect_new() diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index dd50a0eaf..aa4fecd89 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -630,9 +630,9 @@ static const char *Help3d[]= { "Mapster32 3D mode help", " ", - " F1 = TOGGLE THIS HELP DISPLAY", " F2 = TOGGLE CLIPBOARD", - " F3 = MOUSELOOK", + " F3 = TOGGLE MOUSELOOK", + " F4 = TOGGLE AMBIENT SOUNDS", " F6 = AUTOMATIC SECTOREFFECTOR HELP", " F7 = AUTOMATIC SECTOR TAG HELP", "", @@ -641,7 +641,7 @@ static const char *Help3d[]= " ' R = TOGGLE FRAMERATE DISPLAY", " ' W = TOGGLE SPRITE DISPLAY", " ' X = MAP SHADE PREVIEW", - " ' Y = TOGGLE PURPLE BACKGROUND", + " ' I = TOGGLE INVISIBLE SPRITES", "", " ' T = CHANGE LOTAG", " ' H = CHANGE HITAG", @@ -5425,7 +5425,7 @@ static void Keys3d(void) { static const char *cfs[2] = { "ceiling", "floor" }; #ifdef YAX_ENABLE - int16_t bunchnum, maxbunchnum=-1, cb, fb; + int16_t bunchnum=-1, maxbunchnum=-1, cb, fb; Bmemset(havebunch, 0, sizeof(havebunch)); #endif for (j=0; j<(k?k:1); j++, sect=highlightsector[j]) @@ -5663,7 +5663,7 @@ static void Keys3d(void) Bsprintf(tempbuf,"%d",shadepreview); break; case 13: - Bsprintf(tempbuf,"%d",purpleon); + Bsprintf(tempbuf,"%d",showinvisibility); break; default : Bsprintf(tempbuf," ");