From 310c7240e1c14fff6f22c0f72ba03cce1571c769 Mon Sep 17 00:00:00 2001 From: terminx Date: Fri, 16 May 2008 19:51:38 +0000 Subject: [PATCH] Huge, awesome patch from Hunter_rus git-svn-id: https://svn.eduke32.com/eduke32@728 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/include/editor.h | 4 +- polymer/build/src/build.c | 3055 ++++++++++++++-------------- polymer/build/src/config.c | 12 +- polymer/build/src/engine.c | 39 + polymer/build/src/mdsprite.c | 18 +- polymer/build/src/polymost.c | 33 +- polymer/eduke32/source/actors.c | 7 +- polymer/eduke32/source/astub.c | 1499 ++++++++++++-- polymer/eduke32/source/game.c | 4 + polymer/eduke32/source/gamevars.c | 2 +- polymer/eduke32/source/mapster32.h | 408 ++-- 11 files changed, 3176 insertions(+), 1905 deletions(-) diff --git a/polymer/build/include/editor.h b/polymer/build/include/editor.h index d9bedadd5..efca786c4 100644 --- a/polymer/build/include/editor.h +++ b/polymer/build/include/editor.h @@ -38,12 +38,14 @@ extern int zmode, kensplayerheight; extern short defaultspritecstat; extern short temppicnum, tempcstat, templotag, temphitag, tempextra; -extern unsigned char tempshade, temppal, tempxrepeat, tempyrepeat; +extern unsigned char temppal, tempxrepeat, tempyrepeat; +signed char tempshade; extern unsigned char somethingintab; extern unsigned char buildkeys[NUMBUILDKEYS]; extern int ydim16, xdimgame, ydimgame, bppgame, xdim2d, ydim2d, forcesetup; +extern char unrealedlook, quickmapcycling; extern int ExtInit(void); diff --git a/polymer/build/src/build.c b/polymer/build/src/build.c index 27bac8992..223fc2cae 100644 --- a/polymer/build/src/build.c +++ b/polymer/build/src/build.c @@ -122,13 +122,14 @@ short highlight[MAXWALLS]; short highlightsector[MAXSECTORS], highlightsectorcnt = -1; extern char textfont[128][8]; -static char pskysearch[MAXSECTORS]; +char pskysearch[MAXSECTORS]; short temppicnum, tempcstat, templotag, temphitag, tempextra; -unsigned char tempshade, temppal, tempvis, tempxrepeat, tempyrepeat; +unsigned char temppal, tempvis, tempxrepeat, tempyrepeat; +signed char tempshade; unsigned char somethingintab = 255; -char mlook = 0; +char mlook = 0,mskip=0; char unrealedlook=0, quickmapcycling=0; //PK static char boardfilename[BMAX_PATH], selectedboardfilename[BMAX_PATH]; @@ -137,7 +138,7 @@ static CACHE1D_FIND_REC *finddirs=NULL, *findfiles=NULL, *finddirshigh=NULL, *fi static int numdirs=0, numfiles=0; static int currentlist=0; -static int repeatcountx, repeatcounty; +//static int repeatcountx, repeatcounty; static int fillist[640]; @@ -545,7 +546,7 @@ CANCEL: Bprintf("%s\n",kensig); return(0); } - +/* void showmouse(void) { int i; @@ -557,7 +558,7 @@ void showmouse(void) plotpixel(searchx,searchy-i,whitecol); plotpixel(searchx,searchy+i,whitecol); } -} +}*/ int mhk=0; void loadmhk() @@ -580,29 +581,29 @@ void loadmhk() void editinput(void) { - char smooshyalign, repeatpanalign, buffer[80]; - short /*sectnum, nextsectnum,*/ startwall, endwall, dasector, daang; +// char smooshyalign, repeatpanalign, buffer[80]; +// short sectnum, nextsectnum, startwall, endwall, dasector, daang; int mousz, bstatus; - int i, j, k, /*cnt,*/ tempint=0, doubvel, changedir/*, wallfind[2], daz[2]*/; - int dashade[2], goalz, xvect, yvect, /*PK*/ zvect, hiz, loz; + int i, j, k, /*cnt,*/ tempint=0, doubvel/*, changedir, wallfind[2], daz[2]*/; + int /*dashade[2],*/ goalz, xvect, yvect,/*PK*/ zvect, hiz, loz; short hitsect, hitwall, hitsprite; int hitx, hity, hitz, dax, day, hihit, lohit; // 3B 3C 3D 3E 3F 40 41 42 43 44 57 58 46 // F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SCROLL - if (keystatus[0x57] > 0) //F11 - brightness - { - keystatus[0x57] = 0; - brightness++; - if (brightness >= 16) brightness = 0; - setbrightness(brightness,palette,0); - } - if (keystatus[88] > 0) //F12 - { - screencapture("captxxxx.tga",keystatus[0x2a]|keystatus[0x36]); - keystatus[88] = 0; - } + /* if (keystatus[0x57] > 0) //F11 - brightness + { + keystatus[0x57] = 0; + brightness++; + if (brightness >= 16) brightness = 0; + setbrightness(brightness,palette,0); + } + if (keystatus[88] > 0) //F12 + { + screencapture("captxxxx.tga",keystatus[0x2a]|keystatus[0x36]); + keystatus[88] = 0; + }*/ mousz = 0; getmousevalues(&mousx,&mousy,&bstatus); @@ -620,7 +621,7 @@ void editinput(void) // lmb&rmb: x:strafe y:up/dn (move in local yz plane) // mmb: fwd/back in viewing vector - if (unrealedlook) //PK + if (unrealedlook && !mskip) //PK { if ((bstatus&1) && !(bstatus&(2|4))) { @@ -685,9 +686,11 @@ void editinput(void) } } - if (mlook && !(unrealedlook && bstatus&(1|4))) + if (mskip)mskip=0;else { - ang += (mousx>>1)*msens; + if (mlook && !(unrealedlook && bstatus&(1|4))) +{ + ang += (mousx>>1)*msens; horiz -= (mousy>>2)*msens; if (mousy && !(mousy>>2)) @@ -707,18 +710,19 @@ void editinput(void) osearchy = searchy-mousy; } else if (!(unrealedlook && (bstatus&(1|2|4)))) - { - osearchx = searchx; - osearchy = searchy; - searchx += mousx; - searchy += mousy; - if (searchx < 12) searchx = 12; +{ + osearchx = searchx; + osearchy = searchy; + searchx += mousx; + searchy += mousy; + if (searchx < 12) searchx = 12; if (searchy < 12) searchy = 12; if (searchx > xdim-13) searchx = xdim-13; if (searchy > ydim-13) searchy = ydim-13; } + } - showmouse(); +// showmouse(); // if (keystatus[0x3b] > 0) posx--; // if (keystatus[0x3c] > 0) posx++; @@ -780,14 +784,13 @@ void editinput(void) } getzrange(posx,posy,posz,cursectnum,&hiz,&hihit,&loz,&lohit,128L,CLIPMASK0); - // zmode: 0: normal 1: z-locked 2: free z-movement - if (keystatus[0x3a] > 0) - { - zmode++; - if (zmode == 3) zmode = 0; - if (zmode == 1) zlock = (loz-posz)&0xfffffc00; - keystatus[0x3a] = 0; - } + /* if (keystatus[0x3a] > 0) + { + zmode++; + if (zmode == 3) zmode = 0; + if (zmode == 1) zlock = (loz-posz)&0xfffffc00; + keystatus[0x3a] = 0; + }*/ if (zmode == 0) { @@ -899,1527 +902,1528 @@ void editinput(void) { if ((bstatus&(1|2|4)) > 0) searchit = 0; - if (keystatus[0x4a] > 0) // - - { - keystatus[0x4a] = 0; - if ((keystatus[0x38]|keystatus[0xb8]) > 0) //ALT - { - if ((keystatus[0x1d]|keystatus[0x9d]) > 0) //CTRL + /* if (keystatus[0x4a] > 0) // - { - if (visibility < 16384) visibility += visibility; - } - else - { - if ((keystatus[0x2a]|keystatus[0x36]) == 0) - k = 16; else k = 1; + keystatus[0x4a] = 0; + if ((keystatus[0x38]|keystatus[0xb8]) > 0) //ALT + { + if ((keystatus[0x1d]|keystatus[0x9d]) > 0) //CTRL + { + if (visibility < 16384) visibility += visibility; + } + else + { + if ((keystatus[0x2a]|keystatus[0x36]) == 0) + k = 16; else k = 1; - if (highlightsectorcnt >= 0) - for (i=0;i 0) - { - for (i=0;i= 0) + for (i=0;i 0) + { + for (i=0;i 0) - { - sector[searchsector].visibility++; - if (sector[searchsector].visibility == 240) - sector[searchsector].visibility = 239; - k--; - } - asksave = 1; - } - } - else - { - k = 0; - if (highlightsectorcnt >= 0) - { - for (i=0;i 0) // + - { - keystatus[0x4e] = 0; - if ((keystatus[0x38]|keystatus[0xb8]) > 0) //ALT - { - if ((keystatus[0x1d]|keystatus[0x9d]) > 0) //CTRL - { - if (visibility > 32) visibility >>= 1; - } - else - { - if ((keystatus[0x2a]|keystatus[0x36]) == 0) - k = 16; else k = 1; - - if (highlightsectorcnt >= 0) - for (i=0;i 0) { - while (k > 0) - { - for (i=0;i 0) - { - sector[searchsector].visibility--; - if (sector[searchsector].visibility == 239) - sector[searchsector].visibility = 240; - k--; - } - asksave = 1; - } - } - else - { - k = 0; - if (highlightsectorcnt >= 0) - { - for (i=0;i 0) // PGUP - { - k = 0; - if (highlightsectorcnt >= 0) - { - for (i=0;i= 0) + { + for (i=0;i 0) //CTRL - put sprite on ceiling + if (keystatus[0x4e] > 0) // + { - sprite[searchwall].z = getceilzofslope(searchsector,sprite[searchwall].x,sprite[searchwall].y); - if (sprite[searchwall].cstat&128) sprite[searchwall].z -= ((tilesizy[sprite[searchwall].picnum]*sprite[searchwall].yrepeat)<<1); - if ((sprite[searchwall].cstat&48) != 32) - sprite[searchwall].z += ((tilesizy[sprite[searchwall].picnum]*sprite[searchwall].yrepeat)<<2); + keystatus[0x4e] = 0; + if ((keystatus[0x38]|keystatus[0xb8]) > 0) //ALT + { + if ((keystatus[0x1d]|keystatus[0x9d]) > 0) //CTRL + { + if (visibility > 32) visibility >>= 1; + } + else + { + if ((keystatus[0x2a]|keystatus[0x36]) == 0) + k = 16; else k = 1; + + if (highlightsectorcnt >= 0) + for (i=0;i 0) + { + for (i=0;i 0) + { + sector[searchsector].visibility--; + if (sector[searchsector].visibility == 239) + sector[searchsector].visibility = 240; + k--; + } + asksave = 1; + } + } + else + { + k = 0; + if (highlightsectorcnt >= 0) + { + for (i=0;i 0) // PGUP { k = 0; - if (highlightcnt >= 0) - for (i=0;i= 0) + { + for (i=0;i 0) // PGDN - { - k = 0; - if (highlightsectorcnt >= 0) - { - for (i=0;i sector[searchsector].floorz) - sector[searchsector].ceilingz = sector[searchsector].floorz; - if (searchstat == 3) - { - if ((keystatus[0x1d]|keystatus[0x9d]) > 0) //CTRL - put sprite on ground - { - sprite[searchwall].z = getflorzofslope(searchsector,sprite[searchwall].x,sprite[searchwall].y); - if (sprite[searchwall].cstat&128) sprite[searchwall].z -= ((tilesizy[sprite[searchwall].picnum]*sprite[searchwall].yrepeat)<<1); - } - else - { - k = 0; - if (highlightcnt >= 0) - for (i=0;i 0) //TAB - { - if (searchstat == 0) - { - temppicnum = wall[searchwall].picnum; - tempshade = wall[searchwall].shade; - temppal = wall[searchwall].pal; - tempxrepeat = wall[searchwall].xrepeat; - tempyrepeat = wall[searchwall].yrepeat; - tempcstat = wall[searchwall].cstat; - templotag = wall[searchwall].lotag; - temphitag = wall[searchwall].hitag; - tempextra = wall[searchwall].extra; - } - if (searchstat == 1) - { - temppicnum = sector[searchsector].ceilingpicnum; - tempshade = sector[searchsector].ceilingshade; - temppal = sector[searchsector].ceilingpal; - tempvis = sector[searchsector].visibility; - tempxrepeat = sector[searchsector].ceilingxpanning; - tempyrepeat = sector[searchsector].ceilingypanning; - tempcstat = sector[searchsector].ceilingstat; - templotag = sector[searchsector].lotag; - temphitag = sector[searchsector].hitag; - tempextra = sector[searchsector].extra; - } - if (searchstat == 2) - { - temppicnum = sector[searchsector].floorpicnum; - tempshade = sector[searchsector].floorshade; - temppal = sector[searchsector].floorpal; - tempvis = sector[searchsector].visibility; - tempxrepeat = sector[searchsector].floorxpanning; - tempyrepeat = sector[searchsector].floorypanning; - tempcstat = sector[searchsector].floorstat; - templotag = sector[searchsector].lotag; - temphitag = sector[searchsector].hitag; - tempextra = sector[searchsector].extra; - } - if (searchstat == 3) - { - temppicnum = sprite[searchwall].picnum; - tempshade = sprite[searchwall].shade; - temppal = sprite[searchwall].pal; - tempxrepeat = sprite[searchwall].xrepeat; - tempyrepeat = sprite[searchwall].yrepeat; - tempcstat = sprite[searchwall].cstat; - templotag = sprite[searchwall].lotag; - temphitag = sprite[searchwall].hitag; - tempextra = sprite[searchwall].extra; - } - if (searchstat == 4) - { - temppicnum = wall[searchwall].overpicnum; - tempshade = wall[searchwall].shade; - temppal = wall[searchwall].pal; - tempxrepeat = wall[searchwall].xrepeat; - tempyrepeat = wall[searchwall].yrepeat; - tempcstat = wall[searchwall].cstat; - templotag = wall[searchwall].lotag; - temphitag = wall[searchwall].hitag; - tempextra = wall[searchwall].extra; - } - somethingintab = searchstat; - keystatus[0x0f] = 0; - } - if (keystatus[0x1c] > 0) //Left ENTER - { - if ((keystatus[0x2a]|keystatus[0x36]) > 0) //Either shift key - { - if (((searchstat == 0) || (searchstat == 4)) && ((keystatus[0x1d]|keystatus[0x9d]) > 0)) //Ctrl-shift Enter (auto-shade) - { - dashade[0] = 127; - dashade[1] = -128; - i = searchwall; - do - { - if ((int)wall[i].shade < dashade[0]) dashade[0] = wall[i].shade; - if ((int)wall[i].shade > dashade[1]) dashade[1] = wall[i].shade; - - i = wall[i].point2; - } - while (i != searchwall); - - daang = getangle(wall[wall[searchwall].point2].x-wall[searchwall].x,wall[wall[searchwall].point2].y-wall[searchwall].y); - i = searchwall; - do - { - j = getangle(wall[wall[i].point2].x-wall[i].x,wall[wall[i].point2].y-wall[i].y); - k = ((j+2048-daang)&2047); - if (k > 1024) - k = 2048-k; - wall[i].shade = dashade[0]+mulscale10(k,dashade[1]-dashade[0]); - - i = wall[i].point2; - } - while (i != searchwall); - } - else if (somethingintab < 255) - { - if (searchstat == 0) wall[searchwall].shade = tempshade, wall[searchwall].pal = temppal; - if (searchstat == 1) - { - sector[searchsector].ceilingshade = tempshade, sector[searchsector].ceilingpal = temppal; - if ((somethingintab == 1) || (somethingintab == 2)) - sector[searchsector].visibility = tempvis; + sector[searchsector].ceilingz -= 1024 << ((keystatus[0x1d]|keystatus[0x9d])<<1); // JBF 20031128 + } + else + { + for (j=0;j 0) && (somethingintab < 255)) //Either ctrl key - { - i = searchwall; - do - { - wall[i].picnum = temppicnum; - wall[i].shade = tempshade; - wall[i].pal = temppal; - if ((somethingintab == 0) || (somethingintab == 4)) - { - wall[i].xrepeat = tempxrepeat; - wall[i].yrepeat = tempyrepeat; - wall[i].cstat = tempcstat; - } - fixrepeats((short)i); - i = wall[i].point2; - } - while (i != searchwall); - } - else if (((searchstat == 1) || (searchstat == 2)) && ((keystatus[0x1d]|keystatus[0x9d]) > 0) && (somethingintab < 255)) //Either ctrl key - { - clearbuf(&pskysearch[0],(int)((numsectors+3)>>2),0L); - if (searchstat == 1) - { - i = searchsector; - if ((sector[i].ceilingstat&1) > 0) - pskysearch[i] = 1; - - while (pskysearch[i] == 1) - { - sector[i].ceilingpicnum = temppicnum; - sector[i].ceilingshade = tempshade; - sector[i].ceilingpal = temppal; - if ((somethingintab == 1) || (somethingintab == 2)) + if (k == 0) { - sector[i].ceilingxpanning = tempxrepeat; - sector[i].ceilingypanning = tempyrepeat; - sector[i].ceilingstat = tempcstat; - } - pskysearch[i] = 2; - - startwall = sector[i].wallptr; - endwall = startwall + sector[i].wallnum - 1; - for (j=startwall;j<=endwall;j++) - { - k = wall[j].nextsector; - if (k >= 0) - if ((sector[k].ceilingstat&1) > 0) - if (pskysearch[k] == 0) - pskysearch[k] = 1; - } - - for (j=0;j 0) - pskysearch[i] = 1; - - while (pskysearch[i] == 1) - { - sector[i].floorpicnum = temppicnum; - sector[i].floorshade = tempshade; - sector[i].floorpal = temppal; - if ((somethingintab == 1) || (somethingintab == 2)) - { - sector[i].floorxpanning = tempxrepeat; - sector[i].floorypanning = tempyrepeat; - sector[i].floorstat = tempcstat; - } - pskysearch[i] = 2; - - startwall = sector[i].wallptr; - endwall = startwall + sector[i].wallnum - 1; - for (j=startwall;j<=endwall;j++) - { - k = wall[j].nextsector; - if (k >= 0) - if ((sector[k].floorstat&1) > 0) - if (pskysearch[k] == 0) - pskysearch[k] = 1; - } - - for (j=0;j 0) && (tilesizy[k] > 0)) + i = headspritesect[searchsector]; + while (i != -1) { - j = k; + tempint = getflorzofslope(searchsector,sprite[i].x,sprite[i].y); + if (sprite[i].cstat&128) tempint += ((tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<1); + if (sprite[i].z == tempint) + sprite[i].z -= 1024 << ((keystatus[0x1d]|keystatus[0x9d])<<1); // JBF 20031128 + i = nextspritesect[i]; + } + sector[searchsector].floorz -= 1024 << ((keystatus[0x1d]|keystatus[0x9d])<<1); // JBF 20031128 + } + else + { + for (j=0;j 0) //CTRL - put sprite on ceiling + { + sprite[searchwall].z = getceilzofslope(searchsector,sprite[searchwall].x,sprite[searchwall].y); + if (sprite[searchwall].cstat&128) sprite[searchwall].z -= ((tilesizy[sprite[searchwall].picnum]*sprite[searchwall].yrepeat)<<1); + if ((sprite[searchwall].cstat&48) != 32) + sprite[searchwall].z += ((tilesizy[sprite[searchwall].picnum]*sprite[searchwall].yrepeat)<<2); + } + else + { + k = 0; + if (highlightcnt >= 0) + for (i=0;i 0) // PGDN + { + k = 0; + if (highlightsectorcnt >= 0) + { + for (i=0;i= 0) - wall[wall[searchwall].nextwall].overpicnum = temppicnum; - wall[searchwall].shade = tempshade; - wall[searchwall].pal = temppal; - if (somethingintab == 4) - { - wall[searchwall].xrepeat = tempxrepeat; - wall[searchwall].yrepeat = tempyrepeat; - wall[searchwall].cstat = tempcstat; - wall[searchwall].lotag = templotag; - wall[searchwall].hitag = temphitag; - wall[searchwall].extra = tempextra; - } - fixrepeats(searchwall); - } - } - asksave = 1; - keystatus[0x1c] = 0; - } - if (keystatus[0x2e] > 0) //C - { - keystatus[0x2e] = 0; - if ((keystatus[0x38]|keystatus[0xb8]) > 0) //Alt-C - { - if (somethingintab < 255) - { - switch (searchstat) - { - case 0: - j = wall[searchwall].picnum; - for (i=0;i 0) //V - { - if (searchstat == 0) tempint = wall[searchwall].picnum; - if (searchstat == 1) tempint = sector[searchsector].ceilingpicnum; - if (searchstat == 2) tempint = sector[searchsector].floorpicnum; - if (searchstat == 3) tempint = sprite[searchwall].picnum; - if (searchstat == 4) tempint = wall[searchwall].overpicnum; - tempint = gettile(tempint); - if (searchstat == 0) wall[searchwall].picnum = tempint; - if (searchstat == 1) sector[searchsector].ceilingpicnum = tempint; - if (searchstat == 2) sector[searchsector].floorpicnum = tempint; - if (searchstat == 3) sprite[searchwall].picnum = tempint; - if (searchstat == 4) - { - wall[searchwall].overpicnum = tempint; - if (wall[searchwall].nextwall >= 0) - wall[wall[searchwall].nextwall].overpicnum = tempint; - } - asksave = 1; - keystatus[0x2f] = 0; - } -#endif - if (keystatus[0x1a]) // [ - { - keystatus[0x1a] = 0; - if (keystatus[0x38]|keystatus[0xb8]) - { - i = wall[searchwall].nextsector; - if (i >= 0) - switch (searchstat) - { - case 0: - case 1: - case 4: - alignceilslope(searchsector,wall[searchwall].x,wall[searchwall].y,getceilzofslope(i,wall[searchwall].x,wall[searchwall].y)); - break; - case 2: - alignflorslope(searchsector,wall[searchwall].x,wall[searchwall].y,getflorzofslope(i,wall[searchwall].x,wall[searchwall].y)); - break; - } - } - else - { - i = 512; - if (keystatus[0x36]) i = 8; - if (keystatus[0x2a]) i = 1; - - if (searchstat == 1) - { - if (!(sector[searchsector].ceilingstat&2)) - sector[searchsector].ceilingheinum = 0; - sector[searchsector].ceilingheinum = max(sector[searchsector].ceilingheinum-i,-32768); - } - if (searchstat == 2) - { - if (!(sector[searchsector].floorstat&2)) - sector[searchsector].floorheinum = 0; - sector[searchsector].floorheinum = max(sector[searchsector].floorheinum-i,-32768); - } - } - - if (sector[searchsector].ceilingheinum == 0) - sector[searchsector].ceilingstat &= ~2; - else - sector[searchsector].ceilingstat |= 2; - - if (sector[searchsector].floorheinum == 0) - sector[searchsector].floorstat &= ~2; - else - sector[searchsector].floorstat |= 2; - asksave = 1; - } - if (keystatus[0x1b]) // ] - { - keystatus[0x1b] = 0; - if (keystatus[0x38]|keystatus[0xb8]) - { - i = wall[searchwall].nextsector; - if (i >= 0) - switch (searchstat) - { - case 1: - alignceilslope(searchsector,wall[searchwall].x,wall[searchwall].y,getceilzofslope(i,wall[searchwall].x,wall[searchwall].y)); - break; - case 0: - case 2: - case 4: - alignflorslope(searchsector,wall[searchwall].x,wall[searchwall].y,getflorzofslope(i,wall[searchwall].x,wall[searchwall].y)); - break; - } - } - else - { - i = 512; - if (keystatus[0x36]) i = 8; - if (keystatus[0x2a]) i = 1; - - if (searchstat == 1) - { - if (!(sector[searchsector].ceilingstat&2)) - sector[searchsector].ceilingheinum = 0; - sector[searchsector].ceilingheinum = min(sector[searchsector].ceilingheinum+i,32767); - } - if (searchstat == 2) - { - if (!(sector[searchsector].floorstat&2)) - sector[searchsector].floorheinum = 0; - sector[searchsector].floorheinum = min(sector[searchsector].floorheinum+i,32767); - } - } - - if (sector[searchsector].ceilingheinum == 0) - sector[searchsector].ceilingstat &= ~2; - else - sector[searchsector].ceilingstat |= 2; - - if (sector[searchsector].floorheinum == 0) - sector[searchsector].floorstat &= ~2; - else - sector[searchsector].floorstat |= 2; - - asksave = 1; - } - - smooshyalign = keystatus[0x4c]; - repeatpanalign = (keystatus[0x2a]|keystatus[0x36]); - if ((keystatus[0x4b]|keystatus[0x4d]) > 0) // 4 & 6 (keypad) - { - if ((repeatcountx == 0) || (repeatcountx > 32)) - { - changedir = 0; - if (keystatus[0x4b] > 0) changedir = -1; - if (keystatus[0x4d] > 0) changedir = 1; - - if ((searchstat == 0) || (searchstat == 4)) - { - if (repeatpanalign == 0) - wall[searchwall].xrepeat = changechar(wall[searchwall].xrepeat,changedir,smooshyalign,1); - else - wall[searchwall].xpanning = changechar(wall[searchwall].xpanning,changedir,smooshyalign,0); - } - if ((searchstat == 1) || (searchstat == 2)) - { - if (searchstat == 1) - sector[searchsector].ceilingxpanning = changechar(sector[searchsector].ceilingxpanning,changedir,smooshyalign,0); - else - sector[searchsector].floorxpanning = changechar(sector[searchsector].floorxpanning,changedir,smooshyalign,0); - } - if (searchstat == 3) - { - sprite[searchwall].xrepeat = changechar(sprite[searchwall].xrepeat,changedir,smooshyalign,1); - if (sprite[searchwall].xrepeat < 4) - sprite[searchwall].xrepeat = 4; - } - asksave = 1; - repeatcountx = max(1,repeatcountx-2); - } - repeatcountx += synctics; - } - else - repeatcountx = 0; - - if ((keystatus[0x48]|keystatus[0x50]) > 0) // 2 & 8 (keypad) - { - if ((repeatcounty == 0) || (repeatcounty > 32)) - { - changedir = 0; - if (keystatus[0x48] > 0) changedir = -1; - if (keystatus[0x50] > 0) changedir = 1; - - if ((searchstat == 0) || (searchstat == 4)) - { - if (repeatpanalign == 0) - wall[searchwall].yrepeat = changechar(wall[searchwall].yrepeat,changedir,smooshyalign,1); - else - wall[searchwall].ypanning = changechar(wall[searchwall].ypanning,changedir,smooshyalign,0); - } - if ((searchstat == 1) || (searchstat == 2)) - { - if (searchstat == 1) - sector[searchsector].ceilingypanning = changechar(sector[searchsector].ceilingypanning,changedir,smooshyalign,0); - else - sector[searchsector].floorypanning = changechar(sector[searchsector].floorypanning,changedir,smooshyalign,0); - } - if (searchstat == 3) - { - sprite[searchwall].yrepeat = changechar(sprite[searchwall].yrepeat,changedir,smooshyalign,1); - if (sprite[searchwall].yrepeat < 4) - sprite[searchwall].yrepeat = 4; - } - asksave = 1; - repeatcounty = max(1,repeatcounty-2); - } - repeatcounty += synctics; - //} - } - else - repeatcounty = 0; - - if (keystatus[0x33] > 0) // , Search & fix panning to the left (3D) - { - if (searchstat == 3) - { - i = searchwall; - if ((keystatus[0x2a]|keystatus[0x36]) > 0) - sprite[i].ang = ((sprite[i].ang+2048-1)&2047); - else - { - sprite[i].ang = ((sprite[i].ang+2048-128)&2047); - keystatus[0x33] = 0; - } - } - } - if (keystatus[0x34] > 0) // . Search & fix panning to the right (3D) - { - if ((searchstat == 0) || (searchstat == 4)) - { - AutoAlignWalls((int)searchwall,0L); - - /*wallfind[0] = searchwall; - cnt = 4096; - do - { - wallfind[1] = wall[wallfind[0]].point2; - j = -1; - if (wall[wallfind[1]].picnum == wall[searchwall].picnum) - j = wallfind[1]; - k = wallfind[1]; - - while ((wall[wallfind[1]].nextwall >= 0) && (wall[wall[wallfind[1]].nextwall].point2 != k)) - { - i = wall[wall[wallfind[1]].nextwall].point2; //break if going around in circles on red lines with same picture on both sides - if (wallfind[1] == wall[wall[i].nextwall].point2) - break; - - wallfind[1] = wall[wall[wallfind[1]].nextwall].point2; - if (wall[wallfind[1]].picnum == wall[searchwall].picnum) - j = wallfind[1]; - } - wallfind[1] = j; - - if ((j >= 0) && (wallfind[1] != searchwall)) - { - j = (wall[wallfind[0]].xpanning+(wall[wallfind[0]].xrepeat<<3)) % tilesizx[wall[wallfind[0]].picnum]; - wall[wallfind[1]].cstat &= ~8; //Set to non-flip - wall[wallfind[1]].cstat |= 4; //Set y-orientation - wall[wallfind[1]].xpanning = j; - - for(k=0;k<2;k++) - { - sectnum = sectorofwall((short)wallfind[k]); - nextsectnum = wall[wallfind[k]].nextsector; - - if (nextsectnum == -1) - { - if ((wall[wallfind[k]].cstat&4) == 0) - daz[k] = sector[sectnum].ceilingz; - else - daz[k] = sector[sectnum].floorz; - } - else //topstep - { - if (sector[nextsectnum].ceilingz > sector[sectnum].ceilingz) - daz[k] = sector[nextsectnum].ceilingz; - else if (sector[nextsectnum].floorz < sector[sectnum].floorz) - daz[k] = sector[nextsectnum].floorz; - } - } - - j = (picsiz[wall[searchwall].picnum]>>4); - if ((1<>(j+3)))&255); - wall[wallfind[1]].ypanning = j; - wall[wallfind[1]].yrepeat = wall[wallfind[0]].yrepeat; - if (nextsectnum >= 0) - if (sector[nextsectnum].ceilingz >= sector[sectnum].ceilingz) - if (sector[nextsectnum].floorz <= sector[sectnum].floorz) - { - if (wall[wall[wallfind[1]].nextwall].picnum == wall[searchwall].picnum) - { - wall[wall[wallfind[1]].nextwall].yrepeat = wall[wallfind[0]].yrepeat; - if ((wall[wall[wallfind[1]].nextwall].cstat&4) == 0) - daz[1] = sector[nextsectnum].floorz; - else - daz[1] = sector[sectnum].ceilingz; - wall[wall[wallfind[1]].nextwall].ypanning = j; - } - } - } - wallfind[0] = wallfind[1]; - cnt--; - } - while ((wall[wallfind[0]].picnum == wall[searchwall].picnum) && (wallfind[0] != searchwall) && (cnt > 0)); - */ - - keystatus[0x34] = 0; - } - if (searchstat == 3) - { - i = searchwall; - if ((keystatus[0x2a]|keystatus[0x36]) > 0) - sprite[i].ang = ((sprite[i].ang+2048+1)&2047); - else - { - sprite[i].ang = ((sprite[i].ang+2048+128)&2047); - keystatus[0x34] = 0; - } - } - } - if (keystatus[0x35] > 0) // /? Reset panning&repeat to 0 - { - if ((searchstat == 0) || (searchstat == 4)) - { - wall[searchwall].xpanning = 0; - wall[searchwall].ypanning = 0; - wall[searchwall].xrepeat = 8; - wall[searchwall].yrepeat = 8; - wall[searchwall].cstat = 0; - fixrepeats((short)searchwall); - } - if (searchstat == 1) - { - sector[searchsector].ceilingxpanning = 0; - sector[searchsector].ceilingypanning = 0; - sector[searchsector].ceilingstat &= ~2; - sector[searchsector].ceilingheinum = 0; - } - if (searchstat == 2) - { - sector[searchsector].floorxpanning = 0; - sector[searchsector].floorypanning = 0; - sector[searchsector].floorstat &= ~2; - sector[searchsector].floorheinum = 0; - } - if (searchstat == 3) - { - if ((keystatus[0x2a]|keystatus[0x36]) > 0) - { - sprite[searchwall].xrepeat = sprite[searchwall].yrepeat; - } - else - { - sprite[searchwall].xrepeat = 64; - sprite[searchwall].yrepeat = 64; - } - } - keystatus[0x35] = 0; - asksave = 1; - } - - if (keystatus[0x19] > 0) // P (parallaxing sky) - { - if ((keystatus[0x1d]|keystatus[0x9d]) > 0) - { - parallaxtype++; - if (parallaxtype == 3) - parallaxtype = 0; - } - else if ((keystatus[0x38]|keystatus[0xb8]) > 0) - { - switch (searchstat) - { - case 0: - case 4: - Bstrcpy(buffer,"Wall pal: "); - wall[searchwall].pal = getnumber256(buffer,wall[searchwall].pal,256L,0); - break; - case 1: - Bstrcpy(buffer,"Ceiling pal: "); - sector[searchsector].ceilingpal = getnumber256(buffer,sector[searchsector].ceilingpal,256L,0); - break; - case 2: - Bstrcpy(buffer,"Floor pal: "); - sector[searchsector].floorpal = getnumber256(buffer,sector[searchsector].floorpal,256L,0); - break; - case 3: - Bstrcpy(buffer,"Sprite pal: "); - sprite[searchwall].pal = getnumber256(buffer,sprite[searchwall].pal,256L,0); - break; - } - } - else - { - if ((searchstat == 0) || (searchstat == 1) || (searchstat == 4)) - { - sector[searchsector].ceilingstat ^= 1; - asksave = 1; - } - else if (searchstat == 2) - { - sector[searchsector].floorstat ^= 1; - asksave = 1; - } - } - keystatus[0x19] = 0; - } - - if (keystatus[0x20] != 0) //Alt-D (adjust sprite[].clipdist) - { - keystatus[0x20] = 0; - if ((keystatus[0x38]|keystatus[0xb8]) > 0) - { - if (searchstat == 3) - { - Bstrcpy(buffer,"Sprite clipdist: "); - sprite[searchwall].clipdist = getnumber256(buffer,sprite[searchwall].clipdist,256L,0); - } - } - } - - if (keystatus[0x30] > 0) // B (clip Blocking xor) (3D) - { - if (searchstat == 3) - { - sprite[searchwall].cstat ^= 1; - sprite[searchwall].cstat &= ~256; - sprite[searchwall].cstat |= ((sprite[searchwall].cstat&1)<<8); - asksave = 1; - } - else - { - wall[searchwall].cstat ^= 1; - wall[searchwall].cstat &= ~64; - if ((wall[searchwall].nextwall >= 0) && ((keystatus[0x2a]|keystatus[0x36]) == 0)) - { - wall[wall[searchwall].nextwall].cstat &= ~(1+64); - wall[wall[searchwall].nextwall].cstat |= (wall[searchwall].cstat&1); - } - asksave = 1; - } - keystatus[0x30] = 0; - } - if (keystatus[0x14] > 0) // T (transluscence for sprites/masked walls) - { - /*if (searchstat == 1) //Set masked/transluscent ceilings/floors - { - i = (sector[searchsector].ceilingstat&(128+256)); - sector[searchsector].ceilingstat &= ~(128+256); - switch(i) - { - case 0: sector[searchsector].ceilingstat |= 128; break; - case 128: sector[searchsector].ceilingstat |= 256; break; - case 256: sector[searchsector].ceilingstat |= 384; break; - case 384: sector[searchsector].ceilingstat |= 0; break; - } - asksave = 1; - } - if (searchstat == 2) - { - i = (sector[searchsector].floorstat&(128+256)); - sector[searchsector].floorstat &= ~(128+256); - switch(i) - { - case 0: sector[searchsector].floorstat |= 128; break; - case 128: sector[searchsector].floorstat |= 256; break; - case 256: sector[searchsector].floorstat |= 384; break; - case 384: sector[searchsector].floorstat |= 0; break; - } - asksave = 1; - }*/ - if (searchstat == 3) - { - if ((sprite[searchwall].cstat&2) == 0) - sprite[searchwall].cstat |= 2; - else if ((sprite[searchwall].cstat&512) == 0) - sprite[searchwall].cstat |= 512; - else - sprite[searchwall].cstat &= ~(2+512); - asksave = 1; - } - if (searchstat == 4) - { - if ((wall[searchwall].cstat&128) == 0) - wall[searchwall].cstat |= 128; - else if ((wall[searchwall].cstat&512) == 0) - wall[searchwall].cstat |= 512; - else - wall[searchwall].cstat &= ~(128+512); - - if (wall[searchwall].nextwall >= 0) - { - wall[wall[searchwall].nextwall].cstat &= ~(128+512); - wall[wall[searchwall].nextwall].cstat |= (wall[searchwall].cstat&(128+512)); - } - asksave = 1; - } - keystatus[0x14] = 0; - } - - if (keystatus[0x2] > 0) // 1 (make 1-way wall) - { - if (searchstat != 3) - { - wall[searchwall].cstat ^= 32; - asksave = 1; - } - else - { - sprite[searchwall].cstat ^= 64; - i = sprite[searchwall].cstat; - if ((i&48) == 32) - { - sprite[searchwall].cstat &= ~8; - if ((i&64) > 0) - if (posz > sprite[searchwall].z) - sprite[searchwall].cstat |= 8; - } - asksave = 1; - } - keystatus[0x2] = 0; - } - if (keystatus[0x3] > 0) // 2 (bottom wall swapping) - { - if (searchstat != 3) - { - wall[searchwall].cstat ^= 2; - asksave = 1; - } - keystatus[0x3] = 0; - } - if (keystatus[0x18] > 0) // O (top/bottom orientation - for doors) - { - if ((searchstat == 0) || (searchstat == 4)) - { - wall[searchwall].cstat ^= 4; - asksave = 1; - } - if (searchstat == 3) // O (ornament onto wall) (2D) - { - asksave = 1; - i = searchwall; - - hitscan(sprite[i].x,sprite[i].y,sprite[i].z,sprite[i].sectnum, - sintable[(sprite[i].ang+2560+1024)&2047], - sintable[(sprite[i].ang+2048+1024)&2047], - 0, - &hitsect,&hitwall,&hitsprite,&hitx,&hity,&hitz,CLIPMASK1); - - sprite[i].x = hitx; - sprite[i].y = hity; - sprite[i].z = hitz; - changespritesect(i,hitsect); - if (hitwall >= 0) - sprite[i].ang = ((getangle(wall[wall[hitwall].point2].x-wall[hitwall].x,wall[wall[hitwall].point2].y-wall[hitwall].y)+512)&2047); - - //Make sure sprite's in right sector - if (inside(sprite[i].x,sprite[i].y,sprite[i].sectnum) == 0) - { - j = wall[hitwall].point2; - sprite[i].x -= ksgn(wall[j].y-wall[hitwall].y); - sprite[i].y += ksgn(wall[j].x-wall[hitwall].x); - } - } - keystatus[0x18] = 0; - } - if (keystatus[0x32] > 0) // M (masking walls) - { - if (searchstat != 3) - { - i = wall[searchwall].nextwall; - tempint = (keystatus[0x2a]|keystatus[0x36]); - if (i >= 0) - { - wall[searchwall].cstat ^= 16; - if ((wall[searchwall].cstat&16) > 0) - { - wall[searchwall].cstat &= ~8; - if (tempint == 0) + if (k == 0) { - wall[i].cstat |= 8; //auto other-side flip - wall[i].cstat |= 16; - wall[i].overpicnum = wall[searchwall].overpicnum; + i = headspritesect[searchsector]; + while (i != -1) + { + tempint = getceilzofslope(searchsector,sprite[i].x,sprite[i].y); + if (sprite[i].cstat&128) tempint += ((tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<1); + tempint += ((tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<2); + if (sprite[i].z == tempint) + sprite[i].z += 1024 << ((keystatus[0x1d]|keystatus[0x9d])<<1); // JBF 20031128 + i = nextspritesect[i]; + } + sector[searchsector].ceilingz += 1024 << ((keystatus[0x1d]|keystatus[0x9d])<<1); // JBF 20031128 + } + else + { + for (j=0;j 0) // H (hitscan sensitivity) - { - if (searchstat == 3) - { - sprite[searchwall].cstat ^= 256; - asksave = 1; - } - else - { - wall[searchwall].cstat ^= 64; - if ((wall[searchwall].nextwall >= 0) && ((keystatus[0x2a]|keystatus[0x36]) == 0)) - { - wall[wall[searchwall].nextwall].cstat &= ~64; - wall[wall[searchwall].nextwall].cstat |= (wall[searchwall].cstat&64); - } - asksave = 1; - } - keystatus[0x23] = 0; - } - if (keystatus[0x12] > 0) // E (expand) - { - if (searchstat == 1) - { - sector[searchsector].ceilingstat ^= 8; - asksave = 1; - } - if (searchstat == 2) - { - sector[searchsector].floorstat ^= 8; - asksave = 1; - } - keystatus[0x12] = 0; - } - if (keystatus[0x13] > 0) // R (relative alignment, rotation) - { - if (searchstat == 1) - { - sector[searchsector].ceilingstat ^= 64; - asksave = 1; - } - if (searchstat == 2) - { - sector[searchsector].floorstat ^= 64; - asksave = 1; - } - if (searchstat == 3) - { - i = sprite[searchwall].cstat; - if ((i&48) < 32) i += 16; else i &= ~48; - sprite[searchwall].cstat = i; - asksave = 1; - } - keystatus[0x13] = 0; - } - if (keystatus[0x21] > 0) //F (Flip) - { - keystatus[0x21] = 0; - if ((keystatus[0x38]|keystatus[0xb8]) > 0) //ALT-F (relative alignmment flip) - { - if (searchstat != 3) - { - setfirstwall(searchsector,searchwall); - asksave = 1; - } - } - else - { - if ((searchstat == 0) || (searchstat == 4)) - { - i = wall[searchwall].cstat; - i = ((i>>3)&1)+((i>>7)&2); //3-x,8-y - switch (i) + if (sector[searchsector].ceilingz > sector[searchsector].floorz) + sector[searchsector].ceilingz = sector[searchsector].floorz; + if (searchstat == 3) { - case 0: - i = 1; break; - case 1: - i = 3; break; - case 2: - i = 0; break; - case 3: - i = 2; break; + if ((keystatus[0x1d]|keystatus[0x9d]) > 0) //CTRL - put sprite on ground + { + sprite[searchwall].z = getflorzofslope(searchsector,sprite[searchwall].x,sprite[searchwall].y); + if (sprite[searchwall].cstat&128) sprite[searchwall].z -= ((tilesizy[sprite[searchwall].picnum]*sprite[searchwall].yrepeat)<<1); + } + else + { + k = 0; + if (highlightcnt >= 0) + for (i=0;i 0) //TAB { - i = sector[searchsector].ceilingstat; - i = (i&0x4)+((i>>4)&3); - switch (i) + if (searchstat == 0) { - case 0: - i = 6; break; - case 6: - i = 3; break; - case 3: - i = 5; break; - case 5: - i = 1; break; - case 1: - i = 7; break; - case 7: - i = 2; break; - case 2: - i = 4; break; - case 4: - i = 0; break; + temppicnum = wall[searchwall].picnum; + tempshade = wall[searchwall].shade; + temppal = wall[searchwall].pal; + tempxrepeat = wall[searchwall].xrepeat; + tempyrepeat = wall[searchwall].yrepeat; + tempcstat = wall[searchwall].cstat; + templotag = wall[searchwall].lotag; + temphitag = wall[searchwall].hitag; + tempextra = wall[searchwall].extra; } - i = (i&0x4)+((i&3)<<4); - sector[searchsector].ceilingstat &= ~0x34; - sector[searchsector].ceilingstat |= i; - asksave = 1; - } - if (searchstat == 2) //8-way floor flipping (bits 2,4,5) - { - i = sector[searchsector].floorstat; - i = (i&0x4)+((i>>4)&3); - switch (i) + if (searchstat == 1) { - case 0: - i = 6; break; - case 6: - i = 3; break; - case 3: - i = 5; break; - case 5: - i = 1; break; - case 1: - i = 7; break; - case 7: - i = 2; break; - case 2: - i = 4; break; - case 4: - i = 0; break; + temppicnum = sector[searchsector].ceilingpicnum; + tempshade = sector[searchsector].ceilingshade; + temppal = sector[searchsector].ceilingpal; + tempvis = sector[searchsector].visibility; + tempxrepeat = sector[searchsector].ceilingxpanning; + tempyrepeat = sector[searchsector].ceilingypanning; + tempcstat = sector[searchsector].ceilingstat; + templotag = sector[searchsector].lotag; + temphitag = sector[searchsector].hitag; + tempextra = sector[searchsector].extra; } - i = (i&0x4)+((i&3)<<4); - sector[searchsector].floorstat &= ~0x34; - sector[searchsector].floorstat |= i; - asksave = 1; - } - if (searchstat == 3) - { - i = sprite[searchwall].cstat; - if (((i&48) == 32) && ((i&64) == 0)) + if (searchstat == 2) { - sprite[searchwall].cstat &= ~0xc; - sprite[searchwall].cstat |= (i&4)^4; + temppicnum = sector[searchsector].floorpicnum; + tempshade = sector[searchsector].floorshade; + temppal = sector[searchsector].floorpal; + tempvis = sector[searchsector].visibility; + tempxrepeat = sector[searchsector].floorxpanning; + tempyrepeat = sector[searchsector].floorypanning; + tempcstat = sector[searchsector].floorstat; + templotag = sector[searchsector].lotag; + temphitag = sector[searchsector].hitag; + tempextra = sector[searchsector].extra; + } + if (searchstat == 3) + { + temppicnum = sprite[searchwall].picnum; + tempshade = sprite[searchwall].shade; + temppal = sprite[searchwall].pal; + tempxrepeat = sprite[searchwall].xrepeat; + tempyrepeat = sprite[searchwall].yrepeat; + tempcstat = sprite[searchwall].cstat; + templotag = sprite[searchwall].lotag; + temphitag = sprite[searchwall].hitag; + tempextra = sprite[searchwall].extra; + } + if (searchstat == 4) + { + temppicnum = wall[searchwall].overpicnum; + tempshade = wall[searchwall].shade; + temppal = wall[searchwall].pal; + tempxrepeat = wall[searchwall].xrepeat; + tempyrepeat = wall[searchwall].yrepeat; + tempcstat = wall[searchwall].cstat; + templotag = wall[searchwall].lotag; + temphitag = wall[searchwall].hitag; + tempextra = wall[searchwall].extra; + } + somethingintab = searchstat; + keystatus[0x0f] = 0; + } + if (keystatus[0x1c] > 0) //Left ENTER + { + if ((keystatus[0x2a]|keystatus[0x36]) > 0) //Either shift key + { + if (((searchstat == 0) || (searchstat == 4)) && ((keystatus[0x1d]|keystatus[0x9d]) > 0)) //Ctrl-shift Enter (auto-shade) + { + dashade[0] = 127; + dashade[1] = -128; + i = searchwall; + do + { + if ((int)wall[i].shade < dashade[0]) dashade[0] = wall[i].shade; + if ((int)wall[i].shade > dashade[1]) dashade[1] = wall[i].shade; + + i = wall[i].point2; + } + while (i != searchwall); + + daang = getangle(wall[wall[searchwall].point2].x-wall[searchwall].x,wall[wall[searchwall].point2].y-wall[searchwall].y); + i = searchwall; + do + { + j = getangle(wall[wall[i].point2].x-wall[i].x,wall[wall[i].point2].y-wall[i].y); + k = ((j+2048-daang)&2047); + if (k > 1024) + k = 2048-k; + wall[i].shade = dashade[0]+mulscale10(k,dashade[1]-dashade[0]); + + i = wall[i].point2; + } + while (i != searchwall); + } + else if (somethingintab < 255) + { + if (searchstat == 0) wall[searchwall].shade = tempshade, wall[searchwall].pal = temppal; + if (searchstat == 1) + { + sector[searchsector].ceilingshade = tempshade, sector[searchsector].ceilingpal = temppal; + if ((somethingintab == 1) || (somethingintab == 2)) + sector[searchsector].visibility = tempvis; + } + if (searchstat == 2) + { + sector[searchsector].floorshade = tempshade, sector[searchsector].floorpal = temppal; + if ((somethingintab == 1) || (somethingintab == 2)) + sector[searchsector].visibility = tempvis; + } + if (searchstat == 3) sprite[searchwall].shade = tempshade, sprite[searchwall].pal = temppal; + if (searchstat == 4) wall[searchwall].shade = tempshade, wall[searchwall].pal = temppal; + } + } + else if (((searchstat == 0) || (searchstat == 4)) && ((keystatus[0x1d]|keystatus[0x9d]) > 0) && (somethingintab < 255)) //Either ctrl key + { + i = searchwall; + do + { + wall[i].picnum = temppicnum; + wall[i].shade = tempshade; + wall[i].pal = temppal; + if ((somethingintab == 0) || (somethingintab == 4)) + { + wall[i].xrepeat = tempxrepeat; + wall[i].yrepeat = tempyrepeat; + wall[i].cstat = tempcstat; + } + fixrepeats((short)i); + i = wall[i].point2; + } + while (i != searchwall); + } + else if (((searchstat == 1) || (searchstat == 2)) && ((keystatus[0x1d]|keystatus[0x9d]) > 0) && (somethingintab < 255)) //Either ctrl key + { + clearbuf(&pskysearch[0],(int)((numsectors+3)>>2),0L); + if (searchstat == 1) + { + i = searchsector; + if ((sector[i].ceilingstat&1) > 0) + pskysearch[i] = 1; + + while (pskysearch[i] == 1) + { + sector[i].ceilingpicnum = temppicnum; + sector[i].ceilingshade = tempshade; + sector[i].ceilingpal = temppal; + if ((somethingintab == 1) || (somethingintab == 2)) + { + sector[i].ceilingxpanning = tempxrepeat; + sector[i].ceilingypanning = tempyrepeat; + sector[i].ceilingstat = tempcstat; + } + pskysearch[i] = 2; + + startwall = sector[i].wallptr; + endwall = startwall + sector[i].wallnum - 1; + for (j=startwall;j<=endwall;j++) + { + k = wall[j].nextsector; + if (k >= 0) + if ((sector[k].ceilingstat&1) > 0) + if (pskysearch[k] == 0) + pskysearch[k] = 1; + } + + for (j=0;j 0) + pskysearch[i] = 1; + + while (pskysearch[i] == 1) + { + sector[i].floorpicnum = temppicnum; + sector[i].floorshade = tempshade; + sector[i].floorpal = temppal; + if ((somethingintab == 1) || (somethingintab == 2)) + { + sector[i].floorxpanning = tempxrepeat; + sector[i].floorypanning = tempyrepeat; + sector[i].floorstat = tempcstat; + } + pskysearch[i] = 2; + + startwall = sector[i].wallptr; + endwall = startwall + sector[i].wallnum - 1; + for (j=startwall;j<=endwall;j++) + { + k = wall[j].nextsector; + if (k >= 0) + if ((sector[k].floorstat&1) > 0) + if (pskysearch[k] == 0) + pskysearch[k] = 1; + } + + for (j=0;j 0) && (tilesizy[k] > 0)) + { + j = k; + break; + } + sprite[searchwall].picnum = j; + } + sprite[searchwall].shade = tempshade; + sprite[searchwall].pal = temppal; + if (somethingintab == 3) + { + sprite[searchwall].xrepeat = tempxrepeat; + sprite[searchwall].yrepeat = tempyrepeat; + if (sprite[searchwall].xrepeat < 1) sprite[searchwall].xrepeat = 1; + if (sprite[searchwall].yrepeat < 1) sprite[searchwall].yrepeat = 1; + sprite[searchwall].cstat = tempcstat; + sprite[searchwall].lotag = templotag; + sprite[searchwall].hitag = temphitag; + sprite[searchwall].extra = tempextra; + } + } + if (searchstat == 4) + { + wall[searchwall].overpicnum = temppicnum; + if (wall[searchwall].nextwall >= 0) + wall[wall[searchwall].nextwall].overpicnum = temppicnum; + wall[searchwall].shade = tempshade; + wall[searchwall].pal = temppal; + if (somethingintab == 4) + { + wall[searchwall].xrepeat = tempxrepeat; + wall[searchwall].yrepeat = tempyrepeat; + wall[searchwall].cstat = tempcstat; + wall[searchwall].lotag = templotag; + wall[searchwall].hitag = temphitag; + wall[searchwall].extra = tempextra; + } + fixrepeats(searchwall); + } + } + asksave = 1; + keystatus[0x1c] = 0; + } + if (keystatus[0x2e] > 0) //C + { + keystatus[0x2e] = 0; + if ((keystatus[0x38]|keystatus[0xb8]) > 0) //Alt-C + { + if (somethingintab < 255) + { + switch (searchstat) + { + case 0: + j = wall[searchwall].picnum; + for (i=0;i 0) //V + { + if (searchstat == 0) tempint = wall[searchwall].picnum; + if (searchstat == 1) tempint = sector[searchsector].ceilingpicnum; + if (searchstat == 2) tempint = sector[searchsector].floorpicnum; + if (searchstat == 3) tempint = sprite[searchwall].picnum; + if (searchstat == 4) tempint = wall[searchwall].overpicnum; + tempint = gettile(tempint); + if (searchstat == 0) wall[searchwall].picnum = tempint; + if (searchstat == 1) sector[searchsector].ceilingpicnum = tempint; + if (searchstat == 2) sector[searchsector].floorpicnum = tempint; + if (searchstat == 3) sprite[searchwall].picnum = tempint; + if (searchstat == 4) + { + wall[searchwall].overpicnum = tempint; + if (wall[searchwall].nextwall >= 0) + wall[wall[searchwall].nextwall].overpicnum = tempint; + } + asksave = 1; + keystatus[0x2f] = 0; + } + #endif + if (keystatus[0x1a]) // [ + { + keystatus[0x1a] = 0; + if (keystatus[0x38]|keystatus[0xb8]) + { + i = wall[searchwall].nextsector; + if (i >= 0) + switch (searchstat) + { + case 0: + case 1: + case 4: + alignceilslope(searchsector,wall[searchwall].x,wall[searchwall].y,getceilzofslope(i,wall[searchwall].x,wall[searchwall].y)); + break; + case 2: + alignflorslope(searchsector,wall[searchwall].x,wall[searchwall].y,getflorzofslope(i,wall[searchwall].x,wall[searchwall].y)); + break; + } } else { - i = ((i>>2)&3); - switch (i) + i = 512; + if (keystatus[0x36]) i = 8; + if (keystatus[0x2a]) i = 1; + + if (searchstat == 1) + { + if (!(sector[searchsector].ceilingstat&2)) + sector[searchsector].ceilingheinum = 0; + sector[searchsector].ceilingheinum = max(sector[searchsector].ceilingheinum-i,-32768); + } + if (searchstat == 2) + { + if (!(sector[searchsector].floorstat&2)) + sector[searchsector].floorheinum = 0; + sector[searchsector].floorheinum = max(sector[searchsector].floorheinum-i,-32768); + } + } + + if (sector[searchsector].ceilingheinum == 0) + sector[searchsector].ceilingstat &= ~2; + else + sector[searchsector].ceilingstat |= 2; + + if (sector[searchsector].floorheinum == 0) + sector[searchsector].floorstat &= ~2; + else + sector[searchsector].floorstat |= 2; + asksave = 1; + } + if (keystatus[0x1b]) // ] + { + keystatus[0x1b] = 0; + if (keystatus[0x38]|keystatus[0xb8]) + { + i = wall[searchwall].nextsector; + if (i >= 0) + switch (searchstat) + { + case 1: + alignceilslope(searchsector,wall[searchwall].x,wall[searchwall].y,getceilzofslope(i,wall[searchwall].x,wall[searchwall].y)); + break; + case 0: + case 2: + case 4: + alignflorslope(searchsector,wall[searchwall].x,wall[searchwall].y,getflorzofslope(i,wall[searchwall].x,wall[searchwall].y)); + break; + } + } + else + { + i = 512; + if (keystatus[0x36]) i = 8; + if (keystatus[0x2a]) i = 1; + + if (searchstat == 1) + { + if (!(sector[searchsector].ceilingstat&2)) + sector[searchsector].ceilingheinum = 0; + sector[searchsector].ceilingheinum = min(sector[searchsector].ceilingheinum+i,32767); + } + if (searchstat == 2) + { + if (!(sector[searchsector].floorstat&2)) + sector[searchsector].floorheinum = 0; + sector[searchsector].floorheinum = min(sector[searchsector].floorheinum+i,32767); + } + } + + if (sector[searchsector].ceilingheinum == 0) + sector[searchsector].ceilingstat &= ~2; + else + sector[searchsector].ceilingstat |= 2; + + if (sector[searchsector].floorheinum == 0) + sector[searchsector].floorstat &= ~2; + else + sector[searchsector].floorstat |= 2; + + asksave = 1; + } + + smooshyalign = keystatus[0x4c]; + repeatpanalign = (keystatus[0x2a]|keystatus[0x36]); + if ((keystatus[0x4b]|keystatus[0x4d]) > 0) // 4 & 6 (keypad) + { + if ((repeatcountx == 0) || (repeatcountx > 32)) + { + changedir = 0; + if (keystatus[0x4b] > 0) changedir = -1; + if (keystatus[0x4d] > 0) changedir = 1; + + if ((searchstat == 0) || (searchstat == 4)) + { + if (repeatpanalign == 0) + wall[searchwall].xrepeat = changechar(wall[searchwall].xrepeat,changedir,smooshyalign,1); + else + wall[searchwall].xpanning = changechar(wall[searchwall].xpanning,changedir,smooshyalign,0); + } + if ((searchstat == 1) || (searchstat == 2)) + { + if (searchstat == 1) + sector[searchsector].ceilingxpanning = changechar(sector[searchsector].ceilingxpanning,changedir,smooshyalign,0); + else + sector[searchsector].floorxpanning = changechar(sector[searchsector].floorxpanning,changedir,smooshyalign,0); + } + if (searchstat == 3) + { + sprite[searchwall].xrepeat = changechar(sprite[searchwall].xrepeat,changedir,smooshyalign,1); + if (sprite[searchwall].xrepeat < 4) + sprite[searchwall].xrepeat = 4; + } + asksave = 1; + repeatcountx = max(1,repeatcountx-2); + } + repeatcountx += synctics; + } + else + repeatcountx = 0; + + if ((keystatus[0x48]|keystatus[0x50]) > 0) // 2 & 8 (keypad) + { + if ((repeatcounty == 0) || (repeatcounty > 32)) + { + changedir = 0; + if (keystatus[0x48] > 0) changedir = -1; + if (keystatus[0x50] > 0) changedir = 1; + + if ((searchstat == 0) || (searchstat == 4)) + { + if (repeatpanalign == 0) + wall[searchwall].yrepeat = changechar(wall[searchwall].yrepeat,changedir,smooshyalign,1); + else + wall[searchwall].ypanning = changechar(wall[searchwall].ypanning,changedir,smooshyalign,0); + } + if ((searchstat == 1) || (searchstat == 2)) + { + if (searchstat == 1) + sector[searchsector].ceilingypanning = changechar(sector[searchsector].ceilingypanning,changedir,smooshyalign,0); + else + sector[searchsector].floorypanning = changechar(sector[searchsector].floorypanning,changedir,smooshyalign,0); + } + if (searchstat == 3) + { + sprite[searchwall].yrepeat = changechar(sprite[searchwall].yrepeat,changedir,smooshyalign,1); + if (sprite[searchwall].yrepeat < 4) + sprite[searchwall].yrepeat = 4; + } + asksave = 1; + repeatcounty = max(1,repeatcounty-2); + } + repeatcounty += synctics; + //} + } + else + repeatcounty = 0; + + if (keystatus[0x33] > 0) // , Search & fix panning to the left (3D) + { + if (searchstat == 3) + { + i = searchwall; + if ((keystatus[0x2a]|keystatus[0x36]) > 0) + sprite[i].ang = ((sprite[i].ang+2048-1)&2047); + else + { + sprite[i].ang = ((sprite[i].ang+2048-128)&2047); + keystatus[0x33] = 0; + } + } + } + if (keystatus[0x34] > 0) // . Search & fix panning to the right (3D) + { + if ((searchstat == 0) || (searchstat == 4)) + { + AutoAlignWalls((int)searchwall,0L); + + #if 0 + wallfind[0] = searchwall; + cnt = 4096; + do + { + wallfind[1] = wall[wallfind[0]].point2; + j = -1; + if (wall[wallfind[1]].picnum == wall[searchwall].picnum) + j = wallfind[1]; + k = wallfind[1]; + + while ((wall[wallfind[1]].nextwall >= 0) && (wall[wall[wallfind[1]].nextwall].point2 != k)) + { + i = wall[wall[wallfind[1]].nextwall].point2; //break if going around in circles on red lines with same picture on both sides + if (wallfind[1] == wall[wall[i].nextwall].point2) + break; + + wallfind[1] = wall[wall[wallfind[1]].nextwall].point2; + if (wall[wallfind[1]].picnum == wall[searchwall].picnum) + j = wallfind[1]; + } + wallfind[1] = j; + + if ((j >= 0) && (wallfind[1] != searchwall)) + { + j = (wall[wallfind[0]].xpanning+(wall[wallfind[0]].xrepeat<<3)) % tilesizx[wall[wallfind[0]].picnum]; + wall[wallfind[1]].cstat &= ~8; //Set to non-flip + wall[wallfind[1]].cstat |= 4; //Set y-orientation + wall[wallfind[1]].xpanning = j; + + for(k=0;k<2;k++) + { + sectnum = sectorofwall((short)wallfind[k]); + nextsectnum = wall[wallfind[k]].nextsector; + + if (nextsectnum == -1) + { + if ((wall[wallfind[k]].cstat&4) == 0) + daz[k] = sector[sectnum].ceilingz; + else + daz[k] = sector[sectnum].floorz; + } + else //topstep + { + if (sector[nextsectnum].ceilingz > sector[sectnum].ceilingz) + daz[k] = sector[nextsectnum].ceilingz; + else if (sector[nextsectnum].floorz < sector[sectnum].floorz) + daz[k] = sector[nextsectnum].floorz; + } + } + + j = (picsiz[wall[searchwall].picnum]>>4); + if ((1<>(j+3)))&255); + wall[wallfind[1]].ypanning = j; + wall[wallfind[1]].yrepeat = wall[wallfind[0]].yrepeat; + if (nextsectnum >= 0) + if (sector[nextsectnum].ceilingz >= sector[sectnum].ceilingz) + if (sector[nextsectnum].floorz <= sector[sectnum].floorz) + { + if (wall[wall[wallfind[1]].nextwall].picnum == wall[searchwall].picnum) + { + wall[wall[wallfind[1]].nextwall].yrepeat = wall[wallfind[0]].yrepeat; + if ((wall[wall[wallfind[1]].nextwall].cstat&4) == 0) + daz[1] = sector[nextsectnum].floorz; + else + daz[1] = sector[sectnum].ceilingz; + wall[wall[wallfind[1]].nextwall].ypanning = j; + } + } + } + wallfind[0] = wallfind[1]; + cnt--; + } + while ((wall[wallfind[0]].picnum == wall[searchwall].picnum) && (wallfind[0] != searchwall) && (cnt > 0)); + #endif + + keystatus[0x34] = 0; + } + if (searchstat == 3) + { + i = searchwall; + if ((keystatus[0x2a]|keystatus[0x36]) > 0) + sprite[i].ang = ((sprite[i].ang+2048+1)&2047); + else + { + sprite[i].ang = ((sprite[i].ang+2048+128)&2047); + keystatus[0x34] = 0; + } + } + } + if (keystatus[0x35] > 0) // /? Reset panning&repeat to 0 + { + if ((searchstat == 0) || (searchstat == 4)) + { + wall[searchwall].xpanning = 0; + wall[searchwall].ypanning = 0; + wall[searchwall].xrepeat = 8; + wall[searchwall].yrepeat = 8; + wall[searchwall].cstat = 0; + fixrepeats((short)searchwall); + } + if (searchstat == 1) + { + sector[searchsector].ceilingxpanning = 0; + sector[searchsector].ceilingypanning = 0; + sector[searchsector].ceilingstat &= ~2; + sector[searchsector].ceilingheinum = 0; + } + if (searchstat == 2) + { + sector[searchsector].floorxpanning = 0; + sector[searchsector].floorypanning = 0; + sector[searchsector].floorstat &= ~2; + sector[searchsector].floorheinum = 0; + } + if (searchstat == 3) + { + if ((keystatus[0x2a]|keystatus[0x36]) > 0) + { + sprite[searchwall].xrepeat = sprite[searchwall].yrepeat; + } + else + { + sprite[searchwall].xrepeat = 64; + sprite[searchwall].yrepeat = 64; + } + } + keystatus[0x35] = 0; + asksave = 1; + } + + if (keystatus[0x19] > 0) // P (parallaxing sky) + { + if ((keystatus[0x1d]|keystatus[0x9d]) > 0) + { + parallaxtype++; + if (parallaxtype == 3) + parallaxtype = 0; + } + else if ((keystatus[0x38]|keystatus[0xb8]) > 0) + { + switch (searchstat) { case 0: - i = 1; break; + case 4: + Bstrcpy(buffer,"Wall pal: "); + wall[searchwall].pal = getnumber256(buffer,wall[searchwall].pal,256L,0); + break; case 1: - i = 3; break; + Bstrcpy(buffer,"Ceiling pal: "); + sector[searchsector].ceilingpal = getnumber256(buffer,sector[searchsector].ceilingpal,256L,0); + break; case 2: - i = 0; break; + Bstrcpy(buffer,"Floor pal: "); + sector[searchsector].floorpal = getnumber256(buffer,sector[searchsector].floorpal,256L,0); + break; case 3: - i = 2; break; + Bstrcpy(buffer,"Sprite pal: "); + sprite[searchwall].pal = getnumber256(buffer,sprite[searchwall].pal,256L,0); + break; } - i <<= 2; - sprite[searchwall].cstat &= ~0xc; - sprite[searchwall].cstat |= i; } - asksave = 1; + else + { + if ((searchstat == 0) || (searchstat == 1) || (searchstat == 4)) + { + sector[searchsector].ceilingstat ^= 1; + asksave = 1; + } + else if (searchstat == 2) + { + sector[searchsector].floorstat ^= 1; + asksave = 1; + } + } + keystatus[0x19] = 0; } - } - } + + if (keystatus[0x20] != 0) //Alt-D (adjust sprite[].clipdist) + { + keystatus[0x20] = 0; + if ((keystatus[0x38]|keystatus[0xb8]) > 0) + { + if (searchstat == 3) + { + Bstrcpy(buffer,"Sprite clipdist: "); + sprite[searchwall].clipdist = getnumber256(buffer,sprite[searchwall].clipdist,256L,0); + } + } + } + + if (keystatus[0x30] > 0) // B (clip Blocking xor) (3D) + { + if (searchstat == 3) + { + sprite[searchwall].cstat ^= 1; + sprite[searchwall].cstat &= ~256; + sprite[searchwall].cstat |= ((sprite[searchwall].cstat&1)<<8); + asksave = 1; + } + else + { + wall[searchwall].cstat ^= 1; + wall[searchwall].cstat &= ~64; + if ((wall[searchwall].nextwall >= 0) && ((keystatus[0x2a]|keystatus[0x36]) == 0)) + { + wall[wall[searchwall].nextwall].cstat &= ~(1+64); + wall[wall[searchwall].nextwall].cstat |= (wall[searchwall].cstat&1); + } + asksave = 1; + } + keystatus[0x30] = 0; + } + if (keystatus[0x14] > 0) // T (transluscence for sprites/masked walls) + { + if (searchstat == 1) //Set masked/transluscent ceilings/floors + { + i = (sector[searchsector].ceilingstat&(128+256)); + sector[searchsector].ceilingstat &= ~(128+256); + switch(i) + { + case 0: sector[searchsector].ceilingstat |= 128; break; + case 128: sector[searchsector].ceilingstat |= 256; break; + case 256: sector[searchsector].ceilingstat |= 384; break; + case 384: sector[searchsector].ceilingstat |= 0; break; + } + asksave = 1; + } + if (searchstat == 2) + { + i = (sector[searchsector].floorstat&(128+256)); + sector[searchsector].floorstat &= ~(128+256); + switch(i) + { + case 0: sector[searchsector].floorstat |= 128; break; + case 128: sector[searchsector].floorstat |= 256; break; + case 256: sector[searchsector].floorstat |= 384; break; + case 384: sector[searchsector].floorstat |= 0; break; + } + asksave = 1; + } + if (searchstat == 3) + { + if ((sprite[searchwall].cstat&2) == 0) + sprite[searchwall].cstat |= 2; + else if ((sprite[searchwall].cstat&512) == 0) + sprite[searchwall].cstat |= 512; + else + sprite[searchwall].cstat &= ~(2+512); + asksave = 1; + } + if (searchstat == 4) + { + if ((wall[searchwall].cstat&128) == 0) + wall[searchwall].cstat |= 128; + else if ((wall[searchwall].cstat&512) == 0) + wall[searchwall].cstat |= 512; + else + wall[searchwall].cstat &= ~(128+512); + + if (wall[searchwall].nextwall >= 0) + { + wall[wall[searchwall].nextwall].cstat &= ~(128+512); + wall[wall[searchwall].nextwall].cstat |= (wall[searchwall].cstat&(128+512)); + } + asksave = 1; + } + keystatus[0x14] = 0; + } + + if (keystatus[0x2] > 0) // 1 (make 1-way wall) + { + if (searchstat != 3) + { + wall[searchwall].cstat ^= 32; + asksave = 1; + } + else + { + sprite[searchwall].cstat ^= 64; + i = sprite[searchwall].cstat; + if ((i&48) == 32) + { + sprite[searchwall].cstat &= ~8; + if ((i&64) > 0) + if (posz > sprite[searchwall].z) + sprite[searchwall].cstat |= 8; + } + asksave = 1; + } + keystatus[0x2] = 0; + } + if (keystatus[0x3] > 0) // 2 (bottom wall swapping) + { + if (searchstat != 3) + { + wall[searchwall].cstat ^= 2; + asksave = 1; + } + keystatus[0x3] = 0; + } + if (keystatus[0x18] > 0) // O (top/bottom orientation - for doors) + { + if ((searchstat == 0) || (searchstat == 4)) + { + wall[searchwall].cstat ^= 4; + asksave = 1; + } + if (searchstat == 3) // O (ornament onto wall) (2D) + { + asksave = 1; + i = searchwall; + + hitscan(sprite[i].x,sprite[i].y,sprite[i].z,sprite[i].sectnum, + sintable[(sprite[i].ang+2560+1024)&2047], + sintable[(sprite[i].ang+2048+1024)&2047], + 0, + &hitsect,&hitwall,&hitsprite,&hitx,&hity,&hitz,CLIPMASK1); + + sprite[i].x = hitx; + sprite[i].y = hity; + sprite[i].z = hitz; + changespritesect(i,hitsect); + if (hitwall >= 0) + sprite[i].ang = ((getangle(wall[wall[hitwall].point2].x-wall[hitwall].x,wall[wall[hitwall].point2].y-wall[hitwall].y)+512)&2047); + + //Make sure sprite's in right sector + if (inside(sprite[i].x,sprite[i].y,sprite[i].sectnum) == 0) + { + j = wall[hitwall].point2; + sprite[i].x -= ksgn(wall[j].y-wall[hitwall].y); + sprite[i].y += ksgn(wall[j].x-wall[hitwall].x); + } + } + keystatus[0x18] = 0; + } + if (keystatus[0x32] > 0) // M (masking walls) + { + if (searchstat != 3) + { + i = wall[searchwall].nextwall; + tempint = (keystatus[0x2a]|keystatus[0x36]); + if (i >= 0) + { + wall[searchwall].cstat ^= 16; + if ((wall[searchwall].cstat&16) > 0) + { + wall[searchwall].cstat &= ~8; + if (tempint == 0) + { + wall[i].cstat |= 8; //auto other-side flip + wall[i].cstat |= 16; + wall[i].overpicnum = wall[searchwall].overpicnum; + } + } + else + { + wall[searchwall].cstat &= ~8; + if (tempint == 0) + { + wall[i].cstat &= ~8; //auto other-side unflip + wall[i].cstat &= ~16; + } + } + wall[searchwall].cstat &= ~32; + if (tempint == 0) wall[i].cstat &= ~32; + asksave = 1; + } + } + keystatus[0x32] = 0; + } + if (keystatus[0x23] > 0) // H (hitscan sensitivity) + { + if (searchstat == 3) + { + sprite[searchwall].cstat ^= 256; + asksave = 1; + } + else + { + wall[searchwall].cstat ^= 64; + if ((wall[searchwall].nextwall >= 0) && ((keystatus[0x2a]|keystatus[0x36]) == 0)) + { + wall[wall[searchwall].nextwall].cstat &= ~64; + wall[wall[searchwall].nextwall].cstat |= (wall[searchwall].cstat&64); + } + asksave = 1; + } + keystatus[0x23] = 0; + } + if (keystatus[0x12] > 0) // E (expand) + { + if (searchstat == 1) + { + sector[searchsector].ceilingstat ^= 8; + asksave = 1; + } + if (searchstat == 2) + { + sector[searchsector].floorstat ^= 8; + asksave = 1; + } + keystatus[0x12] = 0; + } + if (keystatus[0x13] > 0) // R (relative alignment, rotation) + { + if (searchstat == 1) + { + sector[searchsector].ceilingstat ^= 64; + asksave = 1; + } + if (searchstat == 2) + { + sector[searchsector].floorstat ^= 64; + asksave = 1; + } + if (searchstat == 3) + { + i = sprite[searchwall].cstat; + if ((i&48) < 32) i += 16; else i &= ~48; + sprite[searchwall].cstat = i; + asksave = 1; + } + keystatus[0x13] = 0; + } + if (keystatus[0x21] > 0) //F (Flip) + { + keystatus[0x21] = 0; + if ((keystatus[0x38]|keystatus[0xb8]) > 0) //ALT-F (relative alignmment flip) + { + if (searchstat != 3) + { + setfirstwall(searchsector,searchwall); + asksave = 1; + } + } + else + { + if ((searchstat == 0) || (searchstat == 4)) + { + i = wall[searchwall].cstat; + i = ((i>>3)&1)+((i>>7)&2); //3-x,8-y + switch (i) + { + case 0: + i = 1; break; + case 1: + i = 3; break; + case 2: + i = 0; break; + case 3: + i = 2; break; + } + i = ((i&1)<<3)+((i&2)<<7); + wall[searchwall].cstat &= ~0x0108; + wall[searchwall].cstat |= i; + asksave = 1; + } + if (searchstat == 1) //8-way ceiling flipping (bits 2,4,5) + { + i = sector[searchsector].ceilingstat; + i = (i&0x4)+((i>>4)&3); + switch (i) + { + case 0: + i = 6; break; + case 6: + i = 3; break; + case 3: + i = 5; break; + case 5: + i = 1; break; + case 1: + i = 7; break; + case 7: + i = 2; break; + case 2: + i = 4; break; + case 4: + i = 0; break; + } + i = (i&0x4)+((i&3)<<4); + sector[searchsector].ceilingstat &= ~0x34; + sector[searchsector].ceilingstat |= i; + asksave = 1; + } + if (searchstat == 2) //8-way floor flipping (bits 2,4,5) + { + i = sector[searchsector].floorstat; + i = (i&0x4)+((i>>4)&3); + switch (i) + { + case 0: + i = 6; break; + case 6: + i = 3; break; + case 3: + i = 5; break; + case 5: + i = 1; break; + case 1: + i = 7; break; + case 7: + i = 2; break; + case 2: + i = 4; break; + case 4: + i = 0; break; + } + i = (i&0x4)+((i&3)<<4); + sector[searchsector].floorstat &= ~0x34; + sector[searchsector].floorstat |= i; + asksave = 1; + } + if (searchstat == 3) + { + i = sprite[searchwall].cstat; + if (((i&48) == 32) && ((i&64) == 0)) + { + sprite[searchwall].cstat &= ~0xc; + sprite[searchwall].cstat |= (i&4)^4; + } + else + { + i = ((i>>2)&3); + switch (i) + { + case 0: + i = 1; break; + case 1: + i = 3; break; + case 2: + i = 0; break; + case 3: + i = 2; break; + } + i <<= 2; + sprite[searchwall].cstat &= ~0xc; + sprite[searchwall].cstat |= i; + } + asksave = 1; + } + } + }*/ if (keystatus[0x1f]) //S (insert sprite) (3D) { dax = 16384; @@ -2530,16 +2534,16 @@ void editinput(void) keystatus[0x1f] = 0; } - if (keystatus[0xd3] > 0) - { - if (searchstat == 3) - { - deletesprite(searchwall); - updatenumsprites(); - asksave = 1; - } - keystatus[0xd3] = 0; - } + /* if (keystatus[0xd3] > 0) + { + if (searchstat == 3) + { + deletesprite(searchwall); + updatenumsprites(); + asksave = 1; + } + keystatus[0xd3] = 0; + }*/ if (keystatus[0x3f]||keystatus[0x40]) //F5,F6 { @@ -2607,6 +2611,7 @@ char changechar(char dachar, int dadir, char smooshyalign, char boundcheck) return(dachar); } #if 0 +/* int gettile(int tilenum) { char snotbuf[80], ch; @@ -2915,6 +2920,7 @@ int drawtilescreen(int pictopleft, int picbox) return(0); } +*/ #endif void overheadeditor(void) @@ -3261,13 +3267,16 @@ void overheadeditor(void) drawline16(searchx+2,searchy+1,searchx+9,searchy+1,col); //Draw the white pixel closest to mouse cursor on linehighlight - getclosestpointonwall(mousxplc,mousyplc,(int)linehighlight,&dax,&day); - x2 = mulscale14(dax-posx,zoom); - y2 = mulscale14(day-posy,zoom); - if (wall[linehighlight].nextsector >= 0) - drawline16(halfxdim16+x2,midydim16+y2,halfxdim16+x2,midydim16+y2,15); - else - drawline16(halfxdim16+x2,midydim16+y2,halfxdim16+x2,midydim16+y2,5); + if (linehighlight>=0) + { + getclosestpointonwall(mousxplc,mousyplc,(int)linehighlight,&dax,&day); + x2 = mulscale14(dax-posx,zoom); + y2 = mulscale14(day-posy,zoom); + if (wall[linehighlight].nextsector >= 0) + drawline16(halfxdim16+x2,midydim16+y2,halfxdim16+x2,midydim16+y2,15); + else + drawline16(halfxdim16+x2,midydim16+y2,halfxdim16+x2,midydim16+y2,5); + } enddrawing(); //}}} OSD_Draw(); @@ -6237,7 +6246,7 @@ int getlinehighlight(int xplc, int yplc) if (numwalls == 0) return(-1); dist = 1024; - closest = numwalls-1; + closest = -1; for (i=0;i= 0) + if (closest>=0 && wall[closest].nextwall >= 0) { //if red line, allow highlighting of both sides x1 = wall[closest].x; @@ -7301,7 +7310,7 @@ int loadnames(void) int loadnames(void) { char buffer[1024], *p, *name, *number, *endptr; - int num, syms=0, line=0, a; + int num, syms=0, line=0, a, comment=0; BFILE *fp; fp = fopenfrompath("NAMES.H","r"); @@ -7334,7 +7343,7 @@ int loadnames(void) while (*p == 32) p++; if (*p == 0) continue; // blank line - if (*p == '#') + if (*p == '#' && !comment) { p++; while (*p == 32) p++; @@ -7402,8 +7411,14 @@ int loadnames(void) } else if (*p == '/') { + if (*(p+1) == '*') {comment++;continue;} if (*(p+1) == '/') continue; // comment } + else if (*p == '*' && p[1] == '/') + { + comment--;continue; + } + else if (comment)continue; badline: initprintf("Error: Invalid statement found at character %d on line %d\n", (p-buffer), line-1); } @@ -7768,7 +7783,7 @@ void printmessage256(char name[82]) void getclosestpointonwall(int x, int y, int dawall, int *nx, int *ny) { walltype *wal; - int i, j, dx, dy; + int64 i, j, dx, dy; wal = &wall[dawall]; dx = wall[wal->point2].x-wal->x; @@ -7777,9 +7792,9 @@ void getclosestpointonwall(int x, int y, int dawall, int *nx, int *ny) 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; } - i = divscale30(i,j); - *nx = wal->x + mulscale30(dx,i); - *ny = wal->y + mulscale30(dy,i); + i=((i<<15)/j)<<15; + *nx = wal->x + ((dx*i)>>30); + *ny = wal->y + ((dy*i)>>30); } void initcrc(void) diff --git a/polymer/build/src/config.c b/polymer/build/src/config.c index 125b05267..4e8ee5967 100644 --- a/polymer/build/src/config.c +++ b/polymer/build/src/config.c @@ -199,6 +199,10 @@ int loadsetup(const char *fn) if (readconfig(fp, "mousesensitivity", val, VL) > 0) msens = Bstrtod(val, NULL); + if (readconfig(fp, "mousenavigation", val, VL) > 0) unrealedlook = Batoi(val); + + if (readconfig(fp, "quickmapcycling", val, VL) > 0) quickmapcycling = Batoi(val); + for (i=0;i<256;i++)remap[i]=i; remapinit=1; if (readconfig(fp, "remap", val, VL) > 0) @@ -299,6 +303,12 @@ int writesetup(const char *fn) "; Mouse sensitivity\n" "mousesensitivity = %g\n" "\n" + "; Mouse navigation\n" + "mousenavigation = %d\n" + "\n" + "; Quick map cycling\n" + "quickmapcycling = %d\n" + "\n" #if 1 "; Key Settings\n" "; Here's a map of all the keyboard scan codes: NOTE: values are listed in hex!\n" @@ -358,7 +368,7 @@ int writesetup(const char *fn) #if 0 option[7]>>4, option[2], #endif - option[3], msens, + option[3], msens, unrealedlook, quickmapcycling, #if 1 keys[0], keys[1], keys[2], keys[3], keys[4], keys[5], keys[6], keys[7], keys[8], keys[9], keys[10], keys[11], diff --git a/polymer/build/src/engine.c b/polymer/build/src/engine.c index 2b6cd6294..fab2877e0 100644 --- a/polymer/build/src/engine.c +++ b/polymer/build/src/engine.c @@ -11011,6 +11011,7 @@ void draw2dgrid(int posxe, int posye, short ange, int zoome, short gride) // char spritecol2d[MAXTILES][2]; +int showfirstwall=0; void draw2dscreen(int posxe, int posye, short ange, int zoome, short gride) { @@ -11061,6 +11062,7 @@ void draw2dscreen(int posxe, int posye, short ange, int zoome, short gride) if ((i == linehighlight) || ((linehighlight >= 0) && (i == wall[linehighlight].nextwall))) if (totalclock & 16) col += (2<<2); } + if (showfirstwall && (sector[searchsector].wallptr==i||sector[searchsector].wallptr==wall[i].nextwall))col = 14; xp1 = mulscale14(wal->x-posxe,zoome); yp1 = mulscale14(wal->y-posye,zoome); @@ -11474,6 +11476,30 @@ void printext256(int xpos, int ypos, short col, short backcol, char *name, char for (i=0;name[i];i++) { + if (name[i] == '^' && isdigit(name[i+1])) + { + char smallbuf[8]; + int bi=0; + while (isdigit(name[i+1]) && bi<8) + { + smallbuf[bi++]=name[i+1]; + i++; + } + smallbuf[bi++]=0; + if (col)col = atol(smallbuf); + + if (gammabrightness) + { + p = curpalette[col]; + } + else + { + p.r = britable[curbrightness][ curpalette[col].r ]; + p.g = britable[curbrightness][ curpalette[col].g ]; + p.b = britable[curbrightness][ curpalette[col].b ]; + } + continue; + } letptr = &fontptr[name[i]<<3]; xx = stx-fontsize; yy = ypos+7 + 2; //+1 is hack! @@ -11511,6 +11537,19 @@ void printext256(int xpos, int ypos, short col, short backcol, char *name, char begindrawing(); //{{{ for (i=0;name[i];i++) { + if (name[i] == '^' && isdigit(name[i+1])) + { + char smallbuf[8]; + int bi=0; + while (isdigit(name[i+1]) && bi<8) + { + smallbuf[bi++]=name[i+1]; + i++; + } + smallbuf[bi++]=0; + if (col)col = atol(smallbuf); + continue; + } letptr = &fontptr[name[i]<<3]; ptr = (char *)(ylookup[ypos+7]+(stx-fontsize)+frameplace); for (y=7;y>=0;y--) diff --git a/polymer/build/src/mdsprite.c b/polymer/build/src/mdsprite.c index 5bb0b276b..8ddabb009 100644 --- a/polymer/build/src/mdsprite.c +++ b/polymer/build/src/mdsprite.c @@ -441,7 +441,7 @@ void applypalmap(char *pic, char *palmap, int size, int pal) } } -static void applypalmapSkin(char *pic, int sizx, int sizy, int pal) +static void applypalmapSkin(char *pic, int sizx, int sizy, md2model *m, int number, int pal, int surf) { int stage; @@ -449,11 +449,12 @@ static void applypalmapSkin(char *pic, int sizx, int sizy, int pal) for (stage=0;stageskinmap; getpalmap(&stage,&pal1,&pal2); if (!pal1)return; - for (sk = modelhead->skinmap; sk; sk = sk->next) + mdloadskin((md2model *)m,number,pal1,surf); + for (; sk; sk = sk->next) if ((int)sk->palette == pal1&&sk->palmap)break; if (!sk||sk->size!=sizx*sizy)continue; @@ -461,7 +462,7 @@ static void applypalmapSkin(char *pic, int sizx, int sizy, int pal) } } -static int daskinloader(int filh, int *fptr, int *bpl, int *sizx, int *sizy, int *osizx, int *osizy, char *hasalpha, int pal, char effect) +static int daskinloader(int filh, int *fptr, int *bpl, int *sizx, int *sizy, int *osizx, int *osizy, char *hasalpha, int pal, char effect, md2model *m, int number, int surf) { int picfillen, j,y,x; char *picfil,*cptr,al=255; @@ -498,7 +499,7 @@ static int daskinloader(int filh, int *fptr, int *bpl, int *sizx, int *sizy, int { free(picfil); free(pic); return -1; } free(picfil); - applypalmapSkin((char *)pic,tsizx,tsizy,pal); + applypalmapSkin((char *)pic,tsizx,tsizy,m,number,pal,surf); cptr = &britable[gammabrightness ? 0 : curbrightness][0]; r=(glinfo.bgra)?hictinting[pal].b:hictinting[pal].r; g=hictinting[pal].g; @@ -763,7 +764,7 @@ int mdloadskin(md2model *m, int number, int pal, int surf) cachefil = -1; // the compressed version will be saved to disk if ((filh = kopen4load(fn, 0)) < 0) return -1; - if (daskinloader(filh,&fptr,&bpl,&xsiz,&ysiz,&osizx,&osizy,&hasalpha,pal,(globalnoeffect)?0:hictinting[pal].f)) + if (daskinloader(filh,&fptr,&bpl,&xsiz,&ysiz,&osizx,&osizy,&hasalpha,pal,(globalnoeffect)?0:hictinting[pal].f,m,number,surf)) { kclose(filh); initprintf("Failed loading skin file \"%s\"\n", fn); @@ -1617,8 +1618,6 @@ static int md3draw(md3model *m, spritetype *tspr) } for (surfi=0;surfihead.numsurfs;surfi++) { - int pal1; - s = &m->head.surfs[surfi]; v0 = &s->xyzn[m->cframe*s->numverts]; v1 = &s->xyzn[m->nframe*s->numverts]; @@ -1680,9 +1679,6 @@ static int md3draw(md3model *m, spritetype *tspr) mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f; bglLoadMatrixf(mat); // PLAG: End - for (pal1=SPECPAL;pal1<=REDPAL;pal1++) - mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].skinnum,pal1,surfi); - i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].skinnum,globalpal,surfi); if (!i) continue; //i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].skinnum,surfi); //hack for testing multiple surfaces per MD3 bglBindTexture(GL_TEXTURE_2D, i); diff --git a/polymer/build/src/polymost.c b/polymer/build/src/polymost.c index 897cb484d..b305ee207 100644 --- a/polymer/build/src/polymost.c +++ b/polymer/build/src/polymost.c @@ -1249,7 +1249,7 @@ void writexcache(char *fn, int len, int dameth, char effect, texcacheheader *hea unsigned int padx=0, pady=0; GLuint gi; - if (!glinfo.texcompr || !glusetexcompr || !glusetexcache) return; + if (!glinfo.texcompr || !glusetexcompr || !glusetexcache) {initprintf("\n");return;} if (!bglCompressedTexImage2DARB || !bglGetCompressedTexImageARB) { // lacking the necessary extensions to do this @@ -4118,6 +4118,7 @@ void polymost_drawrooms() { short hitsect, hitwall, hitsprite; int vx, vy, vz, hitx, hity, hitz; + int cz, fz; ox2 = (searchx-ghalfx)/1.2; oy2 = (searchy-ghoriz)/ 1.2; oz2 = ghalfx; @@ -4139,9 +4140,12 @@ void polymost_drawrooms() hitallsprites = 1; hitscan(globalposx,globalposy,globalposz,globalcursectnum, //Start position vx>>12,vy>>12,vz>>8,&hitsect,&hitwall,&hitsprite,&hitx,&hity,&hitz,0xffff0030); + getzsofslope(hitsect,hitx,hity,&cz,&fz); hitallsprites = 0; searchsector = hitsect; + if (hitzfz) searchstat = 2;else if (hitwall >= 0) { searchwall = hitwall; searchstat = 0; @@ -5547,6 +5551,31 @@ int polymost_printext256(int xpos, int ypos, short col, short backcol, char *nam bglBegin(GL_QUADS); for (c=0; name[c]; c++) { + if (name[c] == '^' && isdigit(name[c+1])) + { + char smallbuf[8]; + int bi=0; + while (isdigit(name[c+1]) && bi<8) + { + smallbuf[bi++]=name[c+1]; + c++; + } + smallbuf[bi++]=0; + if (col)col = atol(smallbuf); + + if (gammabrightness) + { + p = curpalette[col]; + } + else + { + p.r = britable[curbrightness][ curpalette[col].r ]; + p.g = britable[curbrightness][ curpalette[col].g ]; + p.b = britable[curbrightness][ curpalette[col].b ]; + } + bglColor4ub(p.r,p.g,p.b,255); + continue; + } tx = (float)(name[c]%32)/32.0; ty = (float)((name[c]/32) + (fontsize*8))/16.0; @@ -5932,8 +5961,6 @@ void polymost_precache(int dapicnum, int dapalnum, int datype) for (i=0;i<=j;i++) { - int pal1; - for (pal1=SPECPAL;pal1<=REDPAL;pal1++)mdloadskin((md2model*)models[mid],0,pal1,i); mdloadskin((md2model*)models[mid], 0, dapalnum, i); } } diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 435284769..acace328a 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -2393,10 +2393,15 @@ static void moveweapons(void) } for (f=1;f<=hittype[i].projectile.velmult;f++) + { + dax = s->x; + day = s->y; + daz = s->z; j = movesprite(i, (k*(sintable[(s->ang+512)&2047]))>>14, (k*(sintable[s->ang&2047]))>>14,ll,qq); - + if (j)break; + } if (!(hittype[i].projectile.workslike & PROJECTILE_FLAG_BOUNCESOFFWALLS) && s->yvel >= 0) if (FindDistance2D(s->x-sprite[s->yvel].x,s->y-sprite[s->yvel].y) < 256) diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 0605bfe9b..09493321a 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -38,7 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "scriptfile.h" #include "crc32.h" -#define VERSION " 1.1.0 svn" +#define VERSION " 1.2.0 svn" static int floor_over_floor; @@ -47,6 +47,7 @@ static char setupfilename[BMAX_PATH]= "mapster32.cfg"; static char defaultduke3dgrp[BMAX_PATH] = "duke3d.grp"; static char *duke3dgrp = defaultduke3dgrp; static int fixmapbeforesaving = 1; +static int lastsave = -180*60; static int NoAutoLoad = 0; #if !defined(_WIN32) @@ -161,6 +162,12 @@ char *type2str[]={"Wall","Sector","Sector","Sprite","Wall"}; static CACHE1D_FIND_REC *finddirs=NULL, *findfiles=NULL, *finddirshigh=NULL, *findfileshigh=NULL; static int numdirs=0, numfiles=0; static int currentlist=0; +static int mouseaction=0, mouseax=0, mouseay=0; +static int repeatcountx, repeatcounty; +static int infobox=1; + +extern char mskip; + static void clearfilenames(void) { @@ -1585,10 +1592,10 @@ static void message(char message[162]) char tmpbuf[2048]; _message(message); + lastmessagetime = totalclock; Bstrcpy(tmpbuf,message); Bstrcat(tmpbuf,"\n"); - OSD_Printf(tmpbuf); - lastmessagetime = totalclock; + if (!mouseaction)OSD_Printf(tmpbuf); } static char lockbyte4094; @@ -1658,13 +1665,20 @@ static void m32_showmouse(void) } } -static int AskIfSure(void) +static int AskIfSure(char *text) { int retval=1; - begindrawing(); //{{{ - printext256(0,0,whitecol,0,"Are you sure you want to proceed?",0); - enddrawing(); //}}} + if (qsetmode == 200) + { + begindrawing(); //{{{ + printext256(0,0,whitecol,0,text?text:"Are you sure you want to proceed?",0); + enddrawing(); //}}} + } + else + { + printmessage16(text?text:"Are you sure you want to proceed?"); + } showframe(1); @@ -1739,7 +1753,7 @@ static int OnSelectTile(int iTile); static int s_Zoom = INITIAL_ZOOM; static int s_TileZoom = 1; -static int DrawTiles(int iTopLeft, int iSelected, int nXTiles, int nYTiles, int TileDim); +static int DrawTiles(int iTopLeft, int iSelected, int nXTiles, int nYTiles, int TileDim, int offset); static int m32gettile(int idInitialTile) @@ -1749,6 +1763,7 @@ static int m32gettile(int idInitialTile) int i; int iTile, iTopLeftTile; int idSelectedTile; + int mousedx, mousedy, mtile, omousex=searchx, omousey=searchy, moffset=0; // Enable following line for testing. I couldn't work out how to change vidmode on the fly // s_Zoom = NUM_ZOOMS - 1; @@ -1912,15 +1927,45 @@ static int m32gettile(int idInitialTile) iTopLeftTile = MAXTILES-nDisplayedTiles; } - + searchx=((iTile-iTopLeftTile)%nXTiles)*ZoomToThumbSize[s_Zoom]+ZoomToThumbSize[s_Zoom]/2; + searchy=((iTile-iTopLeftTile)/nXTiles)*ZoomToThumbSize[s_Zoom]+ZoomToThumbSize[s_Zoom]/2; //////////////////////////////// // Start of key handling code // //////////////////////////////// - while ((keystatus[KEYSC_ENTER]|keystatus[KEYSC_ESC]) == 0) // <- Presumably one of these is escape key ??? + while ((keystatus[KEYSC_ENTER]|keystatus[KEYSC_ESC]|(bstatus&1)) == 0) // <- Presumably one of these is escape key ??? { - DrawTiles(iTopLeftTile, iTile, nXTiles, nYTiles, ZoomToThumbSize[s_Zoom]); + DrawTiles(iTopLeftTile, iTile, nXTiles, nYTiles, ZoomToThumbSize[s_Zoom],moffset); + + getmousevalues(&mousedx,&mousedy,&bstatus); + searchx += mousedx; + searchy += mousedy; + if (searchx < 12) searchx = 12; + if (searchy < 12) searchy = 12; + if (searchx > xdim-13) searchx = xdim-13; + if (searchy > ydim-23) searchy = ydim-23; + if (bstatus&2) + { + moffset+=mousedy; + if (iTopLeftTile==0 && moffset>0)moffset=0; + while (moffset>ZoomToThumbSize[s_Zoom]) + { + iTopLeftTile-=nXTiles; + moffset-=ZoomToThumbSize[s_Zoom]; + } + while (moffset<-ZoomToThumbSize[s_Zoom]) + { + iTopLeftTile+=nXTiles; + moffset+=ZoomToThumbSize[s_Zoom]; + } + } + mtile=iTile=(searchx/ZoomToThumbSize[s_Zoom])+((searchy-moffset)/ZoomToThumbSize[s_Zoom])*nXTiles+iTopLeftTile; + while (iTile >= iTopLeftTile + nDisplayedTiles) + { + iTile-=nXTiles; + mtile=iTile; + } if (handleevents()) { @@ -1933,12 +1978,14 @@ static int m32gettile(int idInitialTile) lockclock += synctics; // Zoom in / out using numeric key pad's / and * keys - if (((keystatus[KEYSC_gSLASH] && (unsigned)s_Zoom<(NUM_ZOOMS-1)) - || ((keystatus[KEYSC_gSTAR]) && s_Zoom>0))) + if (((keystatus[KEYSC_gSLASH] || bstatus&16) && s_Zoom<(signed)(NUM_ZOOMS-1)) + || ((keystatus[KEYSC_gSTAR] || bstatus&32) && s_Zoom>0)) { - if (keystatus[KEYSC_gSLASH]) + if (keystatus[KEYSC_gSLASH] || bstatus&16) { keystatus[KEYSC_gSLASH] = 0; + mouseb &= ~16; + bstatus &= ~16; // Watch out : If editor window is small, then the next zoom level // might get so large that even one tile might not fit ! @@ -1952,6 +1999,8 @@ static int m32gettile(int idInitialTile) else { keystatus[KEYSC_gSTAR] = 0; + mouseb &= ~32; + bstatus &= ~32; s_Zoom--; } @@ -1972,7 +2021,8 @@ static int m32gettile(int idInitialTile) { iTopLeftTile = MAXTILES - nDisplayedTiles; } - + // scroll window so mouse points the same tile as it was before zooming + iTopLeftTile-=(searchx/ZoomToThumbSize[s_Zoom])+((searchy-moffset)/ZoomToThumbSize[s_Zoom])*nXTiles+iTopLeftTile-iTile; } if (keystatus[KEYSC_LEFT]) @@ -2089,7 +2139,7 @@ static int m32gettile(int idInitialTile) // Adjust top-left to ensure tilenum is within displayed range of tiles // - while (iTile < iTopLeftTile) + while (iTile < iTopLeftTile - (moffset<0)?nXTiles:0) { iTopLeftTile -= nXTiles; } @@ -2109,7 +2159,7 @@ static int m32gettile(int idInitialTile) iTopLeftTile = MAXTILES - nDisplayedTiles; } - if ((keystatus[KEYSC_ENTER]) == 0) // uh ? Not escape key ? + if ((keystatus[KEYSC_ENTER] || (bstatus&1)) == 0) // uh ? Not escape key ? { idSelectedTile = idInitialTile; } @@ -2131,7 +2181,13 @@ static int m32gettile(int idInitialTile) idSelectedTile = idInitialTile; } } + if (mtile!=iTile) // if changed by keyboard, update mouse cursor + { + searchx=((iTile-iTopLeftTile)%nXTiles)*ZoomToThumbSize[s_Zoom]+ZoomToThumbSize[s_Zoom]/2; + searchy=((iTile-iTopLeftTile)/nXTiles)*ZoomToThumbSize[s_Zoom]+ZoomToThumbSize[s_Zoom]/2+moffset; + } } + searchx=omousex;searchy=omousey; keystatus[KEYSC_ESC] = 0; keystatus[KEYSC_ENTER] = 0; @@ -2313,9 +2369,7 @@ const char * GetTilePixels(const int idTile) return pPixelData; } -#define PIXELS_PER_DISPLAY_LINE ylookup[1] - -static int DrawTiles(int iTopLeft, int iSelected, int nXTiles, int nYTiles, int TileDim) +static int DrawTiles(int iTopLeft, int iSelected, int nXTiles, int nYTiles, int TileDim, int offset) { int XTile, YTile; int iTile, idTile; @@ -2335,13 +2389,13 @@ static int DrawTiles(int iTopLeft, int iSelected, int nXTiles, int nYTiles, int clearview(0); - for (YTile = 0; YTile < nYTiles; YTile++) + for (YTile = 0-(offset>0); YTile < nYTiles+(offset<0)+1; YTile++) { for (XTile = 0; XTile < nXTiles; XTile++) { iTile = iTopLeft + XTile + (YTile * nXTiles); - if (iTile < localartlookupnum) + if (iTile>=0 && iTile < localartlookupnum) { idTile = localartlookup[ iTile ]; @@ -2351,7 +2405,7 @@ static int DrawTiles(int iTopLeft, int iSelected, int nXTiles, int nYTiles, int if (pRawPixels != NULL) { XPos = XTile * TileDim; - YPos = YTile * TileDim; + YPos = YTile * TileDim+offset; if (polymost_drawtilescreen(XPos, YPos, idTile, TileDim, s_TileZoom)) { @@ -2379,16 +2433,17 @@ static int DrawTiles(int iTopLeft, int iSelected, int nXTiles, int nYTiles, int TileSizeX = (TileSizeX / DivInc) * MulInc; TileSizeY = (TileSizeY / DivInc) * MulInc; - pScreen = (char *)ylookup[YPos]+XPos+frameplace; - for (YOffset = 0; YOffset < TileSizeY; YOffset++) { - for (XOffset = 0; XOffset < TileSizeX; XOffset++) + int y=YPos+YOffset; + if (y>=0 && y=0 && YBox=0 && YBox+TileDim=0 && YBox+i>8)&0xFF,(picanm[idTile]>>16)&0xFF); printext256((xdim>>2)+100,ydim-8,whitecol,-1,szT,0); + m32_showmouse(); + enddrawing(); showframe(1); @@ -2454,9 +2516,59 @@ int spriteongroundz(int searchwall) if (sprite[searchwall].cstat&128) z -= ((tilesizy[sprite[searchwall].picnum]*sprite[searchwall].yrepeat)<<1); return z; } + +#define WIND1X 3 +#define WIND1Y 155 +void drawtileinfo(char *title,int x,int y,int picnum,int shade,int pal,int cstat,int lotag,int hitag,int extra) +{ + char buf[64]; + int i,j; + int scale=65526; + int x1; + + j = xdimgame>640?0:1; + i = ydimgame>>6; + + x1=x+80; + if (j)x1/=2; + x1*=320./xdimgame; + scale/=max(tilesizx[picnum],tilesizy[picnum])/24.; + rotatesprite((x1+13)<<16,(y+11)<<16,scale,0,picnum,shade,pal,2,0L,0L,xdim-1L,ydim-1L); + + x*=xdimgame/320.; + y*=ydimgame/200.; + begindrawing(); + printext256(x+2,y+2,0,-1,title,j); + printext256(x,y,255-13,-1,title,j); + + Bsprintf(buf,"Pic:%4d",picnum); + printext256(x+2,y+2+i*1,0,-1,buf,j); + printext256(x,y+i*1,whitecol,-1,buf,j); + Bsprintf(buf,"Shd:%4d",shade); + printext256(x+2,y+2+i*2,0,-1,buf,j); + printext256(x,y+i*2,whitecol,-1,buf,j); + Bsprintf(buf,"Pal:%4d",pal); + printext256(x+2,y+2+i*3,0,-1,buf,j); + printext256(x,y+i*3,whitecol,-1,buf,j); + Bsprintf(buf,"Cst:%4d",cstat); + printext256(x+2,y+2+i*4,0,-1,buf,j); + printext256(x,y+i*4,whitecol,-1,buf,j); + Bsprintf(buf,"Lot:%4d",lotag); + printext256(x+2,y+2+i*5,0,-1,buf,j); + printext256(x,y+i*5,whitecol,-1,buf,j); + Bsprintf(buf,"Hit:%4d",hitag); + printext256(x+2,y+2+i*6,0,-1,buf,j); + printext256(x,y+i*6,whitecol,-1,buf,j); + Bsprintf(buf,"Ext:%4d",extra); + printext256(x+2,y+2+i*7,0,-1,buf,j); + printext256(x,y+i*7,whitecol,-1,buf,j); + enddrawing(); +} +int snap=0;int saveval1,saveval2,saveval3; + static void Keys3d(void) { - int i,count,rate,nexti; + int i,count,rate,nexti,changedir; int j, k, tempint = 0, hiz, loz; int hitx, hity, hitz, hihit, lohit; char smooshyalign=0, repeatpanalign=0, buffer[80]; @@ -2506,77 +2618,100 @@ static void Keys3d(void) } } - if (tabgraphic == 1) - rotatesprite((44+(tilesizx[temppicnum]>>3))<<16,(114)<<16,32768,0,temppicnum,tempshade,temppal,2,0L,0L,xdim-1L,ydim-1L); - else if (tabgraphic == 2) - rotatesprite((44+(tilesizx[temppicnum]>>3))<<16,(114)<<16,16384,0,temppicnum,tempshade,temppal,2,0L,0L,xdim-1L,ydim-1L); - - begindrawing(); - j = xdimgame>640?0:1; - i = (ydimgame>>6)+(j<<2); - printext256((xdimgame>>6)+2,ydimgame-(ydimgame>>1)+2,0,-1,"Clipboard",j); - printext256((xdimgame>>6),ydimgame-(ydimgame>>1),whitecol,-1,"Clipboard",j); - Bsprintf(tempbuf,"Pic: %d %s",temppicnum,names[temppicnum]); - printext256((xdimgame>>6)+2,ydimgame-(ydimgame>>1)+2+i+i,0,-1,tempbuf,j); - printext256((xdimgame>>6),ydimgame-(ydimgame>>1)+i+i,whitecol,-1,tempbuf,j); - Bsprintf(tempbuf,"Shd: %d",tempshade); - printext256((xdimgame>>6)+2,ydimgame-(ydimgame>>1)+2+i+i+i,0,-1,tempbuf,j); - printext256((xdimgame>>6),ydimgame-(ydimgame>>1)+i+i+i,whitecol,-1,tempbuf,j); - Bsprintf(tempbuf,"Pal: %d",temppal); - printext256((xdimgame>>6)+2,ydimgame-(ydimgame>>1)+2+i+i+i+i,0,-1,tempbuf,j); - printext256((xdimgame>>6),ydimgame-(ydimgame>>1)+i+i+i+i,whitecol,-1,tempbuf,j); - Bsprintf(tempbuf,"Cst: %d",tempcstat); - printext256((xdimgame>>6)+2,ydimgame-(ydimgame>>1)+2+i+i+i+i+i,0,-1,tempbuf,j); - printext256((xdimgame>>6),ydimgame-(ydimgame>>1)+i+i+i+i+i,whitecol,-1,tempbuf,j); - Bsprintf(tempbuf,"Lot: %d",templotag); - printext256((xdimgame>>6)+2,ydimgame-(ydimgame>>1)+2+i+i+i+i+i+i,0,-1,tempbuf,j); - printext256((xdimgame>>6),ydimgame-(ydimgame>>1)+i+i+i+i+i+i,whitecol,-1,tempbuf,j); - Bsprintf(tempbuf,"Hit: %d",temphitag); - printext256((xdimgame>>6)+2,ydimgame-(ydimgame>>1)+2+i+i+i+i+i+i+i,0,-1,tempbuf,j); - printext256((xdimgame>>6),ydimgame-(ydimgame>>1)+i+i+i+i+i+i+i,whitecol,-1,tempbuf,j); - Bsprintf(tempbuf,"Ext: %d",tempextra); - printext256((xdimgame>>6)+2,ydimgame-(ydimgame>>1)+2+i+i+i+i+i+i+i+i,0,-1,tempbuf,j); - printext256((xdimgame>>6),ydimgame-(ydimgame>>1)+i+i+i+i+i+i+i+i,whitecol,-1,tempbuf,j); - enddrawing(); + drawtileinfo("Clipboard",3,124,temppicnum,tempshade,temppal,tempcstat,templotag,temphitag,tempextra); }// end if usedcount - if ((totalclock > (lastmessagetime + 120*3))) + if (infobox) { - char msgbuf[2048]; + char lines[8][64]; + int dax, day, dist, height1=0,height2=0,height3=0, num=0; + int x,y; + + height2=sector[searchsector].floorz-sector[searchsector].ceilingz; switch (searchstat) { case 0: case 4: - { - int dax, day, dist; + drawtileinfo("Current",WIND1X,WIND1Y,wall[searchwall].picnum,wall[searchwall].shade, + wall[searchwall].pal,wall[searchwall].cstat,wall[searchwall].lotag, + wall[searchwall].hitag,wall[searchwall].extra); + dax = wall[searchwall].x-wall[wall[searchwall].point2].x; day = wall[searchwall].y-wall[wall[searchwall].point2].y; dist = ksqrt(dax*dax+day*day); - Bsprintf(msgbuf,"Wall %d: length:%d lo:%d hi:%d ex:%d",searchwall,dist,wall[searchwall].lotag,wall[searchwall].hitag,wall[searchwall].extra); - _message(msgbuf); + if (wall[searchwall].nextsector!=-1) + { + int nextsect=wall[searchwall].nextsector; + height1=sector[searchsector].floorz-sector[nextsect].floorz; + height2=sector[nextsect].floorz-sector[nextsect].ceilingz; + height3=sector[nextsect].ceilingz-sector[searchsector].ceilingz; + } + Bsprintf(lines[num++],"Panning: %3d, %3d",wall[searchwall].xpanning,wall[searchwall].ypanning); + Bsprintf(lines[num++],"Repeat: %3d, %3d",wall[searchwall].xrepeat,wall[searchwall].yrepeat); + Bsprintf(lines[num++],"Overpic: %3d",wall[searchwall].overpicnum); + lines[num++][0]=0; + Bsprintf(lines[num++],"^251Wall %d^31",searchwall); + if (wall[searchwall].nextsector!=-1) + Bsprintf(lines[num++],"LoHeight:%d, HiHeight:%d, Length:%d",height1,height3,dist); + else + Bsprintf(lines[num++],"Height:%d, Length:%d",height2,dist); break; - } case 1: - Bsprintf(msgbuf,"Sector %d ceiling: lo:%s hi:%d ex:%d",searchsector,ExtGetSectorCaption(searchsector),sector[searchsector].hitag,sector[searchsector].extra); - _message(msgbuf); + drawtileinfo("Current",WIND1X,WIND1Y,sector[searchsector].ceilingpicnum,sector[searchsector].ceilingshade, + sector[searchsector].ceilingpal,sector[searchsector].ceilingstat, + sector[searchsector].lotag,sector[searchsector].hitag,sector[searchsector].extra); + + Bsprintf(lines[num++],"Panning: %d,%d",sector[searchsector].ceilingxpanning,sector[searchsector].ceilingypanning); + Bsprintf(lines[num++],"CeilingZ: %d",sector[searchsector].ceilingz); + Bsprintf(lines[num++],"Slope: %d",sector[searchsector].ceilingheinum); + lines[num++][0]=0; + Bsprintf(lines[num++],"^251Sector %d^31 ceiling Lotag:%s",searchsector,ExtGetSectorCaption(searchsector)); + Bsprintf(lines[num++],"Height: %d",height2); break; case 2: - Bsprintf(msgbuf,"Sector %d floor: lo:%s hi:%d ex:%d",searchsector,ExtGetSectorCaption(searchsector),sector[searchsector].hitag,sector[searchsector].extra); - _message(msgbuf); + drawtileinfo("Current",WIND1X,WIND1Y,sector[searchsector].floorpicnum,sector[searchsector].floorshade, + sector[searchsector].floorpal,sector[searchsector].floorstat, + sector[searchsector].lotag,sector[searchsector].hitag,sector[searchsector].extra); + + Bsprintf(lines[num++],"Panning: %d,%d",sector[searchsector].floorxpanning,sector[searchsector].floorypanning); + Bsprintf(lines[num++],"FloorZ: %d",sector[searchsector].floorz); + Bsprintf(lines[num++],"Slope: %d",sector[searchsector].floorheinum); + lines[num++][0]=0; + Bsprintf(lines[num++],"^251Sector %d^31 floor Lotag:%s",searchsector,ExtGetSectorCaption(searchsector)); + Bsprintf(lines[num++],"Height:%d",height2); break; case 3: - { + 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); + + Bsprintf(lines[num++],"Repeat: %d,%d",sprite[searchwall].xrepeat,sprite[searchwall].yrepeat); + Bsprintf(lines[num++],"PosXY: %d,%d",sprite[searchwall].x,sprite[searchwall].y); + Bsprintf(lines[num++],"PosZ: "" %d",sprite[searchwall].z);// prevents tab character + lines[num++][0]=0; + if (strlen(names[sprite[searchwall].picnum]) > 0) { if (sprite[searchwall].picnum==SECTOREFFECTOR) - Bsprintf(msgbuf,"Sprite %d %s: lo:%d hi:%d ex:%d",searchwall,SectorEffectorText(searchwall),sprite[searchwall].lotag,sprite[searchwall].hitag,sprite[searchwall].extra); - else Bsprintf(msgbuf,"Sprite %d %s: lo:%d hi:%d ex:%d",searchwall,names[sprite[searchwall].picnum],sprite[searchwall].lotag,sprite[searchwall].hitag,sprite[searchwall].extra); + Bsprintf(lines[num++],"^251Sprite %d^31 %s",searchwall,SectorEffectorText(searchwall)); + else Bsprintf(lines[num++],"^251Sprite %d^31 %s",searchwall,names[sprite[searchwall].picnum]); } - else Bsprintf(msgbuf,"Sprite %d picnum %d: lo:%d hi:%d ex:%d",searchwall,sprite[searchwall].picnum,sprite[searchwall].lotag,sprite[searchwall].hitag,sprite[searchwall].extra); - _message(msgbuf); + else Bsprintf(lines[num++],"^251Sprite %d^31, picnum %d",searchwall,sprite[searchwall].picnum); + Bsprintf(lines[num++],"Elevation:%d",getflorzofslope(searchsector,sprite[searchwall].x,sprite[searchwall].y)-sprite[searchwall].z); break; } + x=WIND1X;y=WIND1Y; + x*=xdimgame/320.; + y*=ydimgame/200.; + y+=(ydimgame>>6)*8; + begindrawing(); + for (i=0;i640?0:1); + printext256(x,y,whitecol,-1,lines[i],xdimgame>640?0:1); + y+=ydimgame>>6; } + enddrawing(); } if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_V]) // ' V @@ -2606,7 +2741,7 @@ static void Keys3d(void) return; } visval = (unsigned char)getnumber256("Visibility of selected sectors: ",sector[searchsector].visibility,256L,0); - if (AskIfSure()) return; + if (AskIfSure(0)) return; for (i = 0; i < highlightsectorcnt; i++) { @@ -2618,11 +2753,13 @@ static void Keys3d(void) if (keystatus[KEYSC_V]) //V { + int oldtile; if (searchstat == 0) tempint = wall[searchwall].picnum; if (searchstat == 1) tempint = sector[searchsector].ceilingpicnum; if (searchstat == 2) tempint = sector[searchsector].floorpicnum; if (searchstat == 3) tempint = sprite[searchwall].picnum; if (searchstat == 4) tempint = wall[searchwall].overpicnum; + oldtile = tempint; tempint = m32gettile(tempint); if (searchstat == 0) wall[searchwall].picnum = tempint; if (searchstat == 1) sector[searchsector].ceilingpicnum = tempint; @@ -2634,7 +2771,7 @@ static void Keys3d(void) if (wall[searchwall].nextwall >= 0) wall[wall[searchwall].nextwall].overpicnum = tempint; } - asksave = 1; + if (oldtile!=tempint)asksave = 1; keystatus[KEYSC_V] = 0; } @@ -2702,7 +2839,7 @@ static void Keys3d(void) pal[1] = getnumber256("Floor palette: ",-1,MAXPALOOKUPS,1); pal[2] = getnumber256("Wall palette: ",-1,MAXPALOOKUPS,1); pal[3] = getnumber256("Sprite palette: ",-1,MAXPALOOKUPS,1); - if (AskIfSure()) return; + if (AskIfSure(0)) return; for (i = 0; i < highlightsectorcnt; i++) { @@ -2750,7 +2887,7 @@ static void Keys3d(void) } pal = (unsigned char)getnumber256("Global palette: ",0,MAXPALOOKUPS,0); - if (AskIfSure()) return; + if (AskIfSure(0)) return; for (i = 0; i < highlightsectorcnt; i++) { @@ -3186,13 +3323,13 @@ static void Keys3d(void) if (k == 0) { - int shade=-1, i=0; - if (searchstat == 0) shade=wall[i=searchwall].shade++; - if (searchstat == 1) shade=sector[i=searchsector].ceilingshade++; - if (searchstat == 2) shade=sector[i=searchsector].floorshade++; - if (searchstat == 3) shade=sprite[i=searchwall].shade++; - if (searchstat == 4) shade=wall[i=searchwall].shade++; - if (shade!=-1) + int shade=-1, i=-1; + if (searchstat == 0) shade=++wall[i=searchwall].shade; + if (searchstat == 1) shade=++sector[i=searchsector].ceilingshade; + if (searchstat == 2) shade=++sector[i=searchsector].floorshade; + if (searchstat == 3) shade=++sprite[i=searchwall].shade; + if (searchstat == 4) shade=++wall[i=searchwall].shade; + if (i!=-1) { Bsprintf(getmessage,"%s %d shade %d",type2str[searchstat],i,shade); message(getmessage); @@ -3283,13 +3420,13 @@ static void Keys3d(void) if (k == 0) { - int shade=-1, i=0; - if (searchstat == 0) shade=wall[i=searchwall].shade--; - if (searchstat == 1) shade=sector[i=searchsector].ceilingshade--; - if (searchstat == 2) shade=sector[i=searchsector].floorshade--; - if (searchstat == 3) shade=sprite[i=searchwall].shade--; - if (searchstat == 4) shade=wall[i=searchwall].shade--; - if (shade!=-1) + int shade=-1, i=-1; + if (searchstat == 0) shade=--wall[i=searchwall].shade; + if (searchstat == 1) shade=--sector[i=searchsector].ceilingshade; + if (searchstat == 2) shade=--sector[i=searchsector].floorshade; + if (searchstat == 3) shade=--sprite[i=searchwall].shade; + if (searchstat == 4) shade=--wall[i=searchwall].shade; + if (i!=-1) { Bsprintf(getmessage,"%s %d shade %d",type2str[searchstat],i,shade); message(getmessage); @@ -3609,9 +3746,17 @@ static void Keys3d(void) updownunits = 512; else updownunits = 1024; - -// if ((keystatus[0xc9] > 0) || ((bstatus&2) && (bstatus&16))) // PGUP - if ((keystatus[0xc9] > 0) || ((bstatus&2) && (bstatus&16) && !(bstatus&1))) // PK: PGUP, rmb only & mwheel + mouseaction=0; + if (eitherALT && bstatus&1) + { + mousex=0;mskip=1; + if (mousey<0) + { + updownunits=klabs(mousey*128); + mouseaction=1; + } + } + if (keystatus[KEYSC_PGUP] || mouseaction || ((bstatus&2) && (bstatus&16 && !(bstatus&1)))) // PK: PGUP, rmb only & mwheel { k = 0; if (highlightsectorcnt >= 0) @@ -3725,7 +3870,7 @@ static void Keys3d(void) if (k == 0) { sprite[searchwall].z -= updownunits; - sprite[searchwall].z = max(sprite[searchwall].z,spriteonceilingz(searchwall)); + if (!noclip)sprite[searchwall].z = max(sprite[searchwall].z,spriteonceilingz(searchwall)); sprintf(getmessage,"Sprite %d z = %d",searchwall,sprite[searchwall].z); message(getmessage); @@ -3736,7 +3881,7 @@ static void Keys3d(void) if ((highlight[i]&0xc000) == 16384) { sprite[highlight[i]&16383].z -= updownunits; - sprite[highlight[i]&16383].z = max(sprite[highlight[i]&16383].z,spriteonceilingz(highlight[i]&16383)); + if (!noclip)sprite[highlight[i]&16383].z = max(sprite[highlight[i]&16383].z,spriteonceilingz(highlight[i]&16383)); } sprintf(getmessage,"Sprite %d z = %d",highlight[i]&16383,sprite[highlight[i]&16383].z); message(getmessage); @@ -3748,8 +3893,18 @@ static void Keys3d(void) keystatus[KEYSC_PGUP] = 0; mouseb &= ~16; } -// if ((keystatus[0xd1] > 0) || ((bstatus&2) && (bstatus&32))) // PGDN - if ((keystatus[0xd1] > 0) || ((bstatus&2) && (bstatus&32) && !(bstatus&1))) // PK: PGDN, rmb only & mwheel + + mouseaction=0; + if (eitherALT && bstatus&1) + { + mousex=0;mskip=1; + if (mousey>0) + { + updownunits=klabs(mousey*128); + mouseaction=1; + } + } + if (keystatus[KEYSC_PGDN] || mouseaction || ((bstatus&2) && (bstatus&32) && !(bstatus&1))) // PK: PGDN, rmb only & mwheel { k = 0; if (highlightsectorcnt >= 0) @@ -3862,7 +4017,7 @@ static void Keys3d(void) if (k == 0) { sprite[searchwall].z += updownunits; - sprite[searchwall].z = min(sprite[searchwall].z,spriteongroundz(searchwall)); + if (!noclip)sprite[searchwall].z = min(sprite[searchwall].z,spriteongroundz(searchwall)); sprintf(getmessage,"Sprite %d z = %d",searchwall,sprite[searchwall].z); message(getmessage); @@ -3873,7 +4028,7 @@ static void Keys3d(void) if ((highlight[i]&0xc000) == 16384) { sprite[highlight[i]&16383].z += updownunits; - sprite[highlight[i]&16383].z = min(sprite[highlight[i]&16383].z,spriteongroundz(highlight[i]&16383)); + if (!noclip)sprite[highlight[i]&16383].z = min(sprite[highlight[i]&16383].z,spriteongroundz(highlight[i]&16383)); } sprintf(getmessage,"Sprite %d z = %d",highlight[i]&16383,sprite[highlight[i]&16383].z); message(getmessage); @@ -3921,6 +4076,31 @@ static void Keys3d(void) else if (bstatus&1 && !(bstatus&2)) Bsprintf(tempbuf,"LOCK"); + if (bstatus&1) + { + Bsprintf(tempbuf,"LOCK"); + switch (searchstat) + { + case 0: + case 4: + if (eitherSHIFT) Bsprintf(tempbuf,"PAN"); + if (eitherCTRL) Bsprintf(tempbuf,"SCALE"); + if (eitherALT) Bsprintf(tempbuf,"Z"); + break; + case 1: + case 2: + if (eitherSHIFT) Bsprintf(tempbuf,"PAN"); + if (eitherCTRL) Bsprintf(tempbuf,"SLOPE"); + if (eitherALT) Bsprintf(tempbuf,"Z"); + break; + case 3: + if (eitherSHIFT) Bsprintf(tempbuf,"MOVE XY"); + if (eitherCTRL) Bsprintf(tempbuf,"SIZE"); + if (eitherALT) Bsprintf(tempbuf,"MOVE Z"); + break; + } + } + if (tempbuf[0] != 0) { i = (Bstrlen(tempbuf)<<3)+6; @@ -4022,14 +4202,14 @@ static void Keys3d(void) message(tempbuf); } - if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_G]) // ' g - { - keystatus[KEYSC_G] = 0; - tabgraphic++; - if (tabgraphic > 2) tabgraphic = 0; - if (tabgraphic) message("Graphics ON"); - else message("Graphics OFF"); - } + /* if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_G]) // ' g + { + keystatus[KEYSC_G] = 0; + tabgraphic++; + if (tabgraphic > 2) tabgraphic = 0; + if (tabgraphic) message("Graphics ON"); + else message("Graphics OFF"); + }*/ if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_X]) // ' x { @@ -4040,13 +4220,13 @@ static void Keys3d(void) } - if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_R]) // ' r - { - keystatus[KEYSC_R] = 0; - framerateon=!framerateon; - if (framerateon) message("Framerate ON"); - else message("Framerate OFF"); - } + /* if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_R]) // ' r + { + keystatus[KEYSC_R] = 0; + framerateon=!framerateon; + if (framerateon) message("Framerate ON"); + else message("Framerate OFF"); + }*/ if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_W]) // ' w { @@ -4196,8 +4376,9 @@ static void Keys3d(void) } } - if (keystatus[0x3c]>0) // F2 + if (keystatus[KEYSC_F2]) // F2 { + if (eitherSHIFT)infobox=!infobox;else usedcount=!usedcount; keystatus[KEYSC_F2] = 0; } @@ -4407,7 +4588,7 @@ static void Keys3d(void) if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_ENTER]) // ' ENTER { - message("Pasted graphic only"); + message("Pasted picnum only"); switch (searchstat) { case 0 : @@ -4429,8 +4610,938 @@ static void Keys3d(void) keystatus[KEYSC_ENTER]=0; } + i = 512; + if (keystatus[KEYSC_RSHIFT]) i = 8; + if (keystatus[KEYSC_LSHIFT]) i = 1; + mouseaction=0; + if (eitherCTRL && bstatus&1 && (searchstat == 1 || searchstat == 2)) + { + mousex=0;mskip=1; + if (mousey<0) + { + i=klabs(mousey*2); + mouseaction=1; + } + } + if (keystatus[KEYSC_LBRACK] || mouseaction) // [ + { + keystatus[KEYSC_LBRACK] = 0; + if (eitherALT) + { + i = wall[searchwall].nextsector; + if (i >= 0) + switch (searchstat) + { + case 0: + case 1: + case 4: + alignceilslope(searchsector,wall[searchwall].x,wall[searchwall].y,getceilzofslope(i,wall[searchwall].x,wall[searchwall].y)); + Bsprintf(tempbuf,"Sector %d align ceiling to wall %d",searchsector,searchwall); + message(tempbuf); + break; + case 2: + alignflorslope(searchsector,wall[searchwall].x,wall[searchwall].y,getflorzofslope(i,wall[searchwall].x,wall[searchwall].y)); + Bsprintf(tempbuf,"Sector %d align floor to wall %d",searchsector,searchwall); + message(tempbuf); + break; + } + } + else + { + if (searchstat == 1) + { + if (!(sector[searchsector].ceilingstat&2)) + sector[searchsector].ceilingheinum = 0; + sector[searchsector].ceilingheinum = max(sector[searchsector].ceilingheinum-i,-32768); + Bsprintf(tempbuf,"Sector %d ceiling slope = %d",searchsector,sector[searchsector].ceilingheinum); + message(tempbuf); + } + if (searchstat == 2) + { + if (!(sector[searchsector].floorstat&2)) + sector[searchsector].floorheinum = 0; + sector[searchsector].floorheinum = max(sector[searchsector].floorheinum-i,-32768); + Bsprintf(tempbuf,"Sector %d floor slope = %d",searchsector,sector[searchsector].floorheinum); + message(tempbuf); + } + } + if (sector[searchsector].ceilingheinum == 0) + sector[searchsector].ceilingstat &= ~2; + else + sector[searchsector].ceilingstat |= 2; + + if (sector[searchsector].floorheinum == 0) + sector[searchsector].floorstat &= ~2; + else + sector[searchsector].floorstat |= 2; + asksave = 1; + } + + i = 512; + if (keystatus[KEYSC_RSHIFT]) i = 8; + if (keystatus[KEYSC_LSHIFT]) i = 1; + mouseaction=0; + if (eitherCTRL && bstatus&1 && (searchstat == 1 || searchstat == 2)) + { + mousex=0;mskip=1; + if (mousey>0) + { + i=klabs(mousey*2); + mouseaction=1; + } + } + if (keystatus[KEYSC_RBRACK] || mouseaction) // ] + { + keystatus[KEYSC_RBRACK] = 0; + if (eitherALT) + { + i = wall[searchwall].nextsector; + if (i >= 0) + switch (searchstat) + { + case 1: + alignceilslope(searchsector,wall[searchwall].x,wall[searchwall].y,getceilzofslope(i,wall[searchwall].x,wall[searchwall].y)); + Bsprintf(tempbuf,"Sector %d align ceiling to wall %d",searchsector,searchwall); + message(tempbuf); + break; + case 0: + case 2: + case 4: + alignflorslope(searchsector,wall[searchwall].x,wall[searchwall].y,getflorzofslope(i,wall[searchwall].x,wall[searchwall].y)); + Bsprintf(tempbuf,"Sector %d align floor to wall %d",searchsector,searchwall); + message(tempbuf); + break; + } + } + else + { + if (searchstat == 1) + { + if (!(sector[searchsector].ceilingstat&2)) + sector[searchsector].ceilingheinum = 0; + sector[searchsector].ceilingheinum = min(sector[searchsector].ceilingheinum+i,32767); + Bsprintf(tempbuf,"Sector %d ceiling slope = %d",searchsector,sector[searchsector].ceilingheinum); + message(tempbuf); + } + if (searchstat == 2) + { + if (!(sector[searchsector].floorstat&2)) + sector[searchsector].floorheinum = 0; + sector[searchsector].floorheinum = min(sector[searchsector].floorheinum+i,32767); + Bsprintf(tempbuf,"Sector %d floor slope = %d",searchsector,sector[searchsector].floorheinum); + message(tempbuf); + } + } + + if (sector[searchsector].ceilingheinum == 0) + sector[searchsector].ceilingstat &= ~2; + else + sector[searchsector].ceilingstat |= 2; + + if (sector[searchsector].floorheinum == 0) + sector[searchsector].floorstat &= ~2; + else + sector[searchsector].floorstat |= 2; + + asksave = 1; + } + + if (bstatus&1 && eitherSHIFT) mskip=1; + if (bstatus&1 && eitherSHIFT && (searchstat == 1 || searchstat == 2) && (mousex|mousey)) + { + int fw,x1,y1,x2,y2,stat,ma,a=0; + + stat=(searchstat==2)?sector[searchsector].floorstat:sector[searchsector].ceilingstat; + if (stat&64) // align to first wall + { + fw=sector[searchsector].wallptr; + x1=wall[fw].x,y1=wall[fw].y; + x2=wall[wall[fw].point2].x,y2=wall[wall[fw].point2].y; + a=getangle(x1-x2,y1-y2); + } + mouseax+=mousex;mouseay+=mousey; + ma=getangle(mouseax,mouseay); + ma+=ang-a; + + i = stat; + i = (i&0x4)+((i>>4)&3); + if (stat&64) // align to first wall + switch (i) + { + case 0:break; + case 1:ma=-ma;break; + case 2:ma=1024-ma;break; + case 3:ma+=1024;break; + case 4:ma=-512-ma;break; + case 5:ma+=512;break; + case 6:ma-=512;break; + case 7:ma=512-ma;break; + } + else + switch (i) + { + case 0:ma=-ma;break; + case 1:break; + case 2:ma+=1024;break; + case 3:ma=1024-ma;break; + case 4:ma-=512;break; + case 5:ma=512-ma;break; + case 6:ma=-512-ma;break; + case 7:ma+=512;break; + } + + a=ksqrt(mouseax*mouseax+mouseay*mouseay); + if (a) + { + int mult=(stat&8)?8192:8192*2; + x1=-a*sintable[(ma+2048)&2047]/mult; + y1=-a*sintable[(ma+1536)&2047]/mult; + if (x1||y1) + { + mouseax=0;mouseay=0; + if (searchstat==1) + { + changedir=1;if (x1<0) {changedir=-1;x1*=-1;} + while (x1--)sector[searchsector].ceilingxpanning = changechar(sector[searchsector].ceilingxpanning,changedir,0,0); + changedir=1;if (y1<0) {changedir=-1;y1*=-1;} + while (y1--)sector[searchsector].ceilingypanning = changechar(sector[searchsector].ceilingypanning,changedir,0,0); + Bsprintf(tempbuf,"Sector %d ceiling panning: %d, %d",searchsector,sector[searchsector].ceilingxpanning,sector[searchsector].ceilingypanning); + } + else + { + changedir=1;if (x1<0) {changedir=-1;x1*=-1;} + while (x1--)sector[searchsector].floorxpanning = changechar(sector[searchsector].floorxpanning,changedir,0,0); + changedir=1;if (y1<0) {changedir=-1;y1*=-1;} + while (y1--)sector[searchsector].floorypanning = changechar(sector[searchsector].floorypanning,changedir,0,0); + Bsprintf(tempbuf,"Sector %d floor panning: %d, %d",searchsector,sector[searchsector].floorxpanning,sector[searchsector].floorypanning); + } + message(tempbuf); + asksave=1; + } + } + mousex=0;mousey=0; + } + if (!mouseb) {mouseax=0;mouseay=0;} + + smooshyalign = keystatus[KEYSC_gKP5]; + repeatpanalign = eitherSHIFT; + + updownunits=1; + mouseaction=0; + + if (bstatus&1 && searchstat != 1 && searchstat != 2) + { + if (eitherSHIFT) + { + mskip=1; + if (mousex!=0) + { + mouseaction=1; + mouseax+=mousex; + updownunits=klabs(mouseax/2.); + if (updownunits) {mouseax=0;} + } + } + else + if (eitherCTRL) + { + mskip=1; + if (mousex!=0) + { + mouseaction=2; + repeatpanalign=0; + if (searchstat==3) + { + updownunits=klabs(mouseax+=mousex)/4; + if (updownunits)mouseax=0; + } + else + { + updownunits=klabs(mouseax+=mousex)/16; + if (updownunits)mouseax=0; + } + } + } + } + + if (keystatus[KEYSC_gLEFT] || keystatus[KEYSC_gRIGHT] || mouseaction) // 4 & 6 (keypad) + { + if ((repeatcountx == 0) || (repeatcountx > 32) || mouseaction) + { + changedir = 0; + if (keystatus[KEYSC_gLEFT] || mousex>0) changedir = -1; + if (keystatus[KEYSC_gRIGHT] || mousex<0) changedir = 1; + + if ((searchstat == 0) || (searchstat == 4)) + { + if (repeatpanalign == 0) + { + while (updownunits--)wall[searchwall].xrepeat = changechar(wall[searchwall].xrepeat,changedir,smooshyalign,1); + Bsprintf(tempbuf,"Wall %d repeat: %d, %d",searchwall,wall[searchwall].xrepeat,wall[searchwall].yrepeat); + } + else + { + if (mouseaction) + { + i=wall[searchwall].cstat; + i=((i>>3)&1)+((i>>7)&2); + if (i==1||i==3)changedir*=-1; + } + while (updownunits--)wall[searchwall].xpanning = changechar(wall[searchwall].xpanning,changedir,smooshyalign,0); + Bsprintf(tempbuf,"Wall %d panning: %d, %d",searchwall,wall[searchwall].xpanning,wall[searchwall].ypanning); + } + message(tempbuf); + } + if ((searchstat == 1) || (searchstat == 2)) + { + if (searchstat == 1) + { + while (updownunits--)sector[searchsector].ceilingxpanning = changechar(sector[searchsector].ceilingxpanning,changedir,smooshyalign,0); + Bsprintf(tempbuf,"Sector %d ceiling panning: %d, %d",searchsector,sector[searchsector].ceilingxpanning,sector[searchsector].ceilingypanning); + } + else + { + while (updownunits--)sector[searchsector].floorxpanning = changechar(sector[searchsector].floorxpanning,changedir,smooshyalign,0); + Bsprintf(tempbuf,"Sector %d floor panning: %d, %d",searchsector,sector[searchsector].floorxpanning,sector[searchsector].floorypanning); + } + message(tempbuf); + } + if (searchstat == 3) + { + if (mouseaction==1) + { + int xvect,yvect; + short cursectnum=sprite[searchwall].sectnum; + xvect = -((mousex*(int)sintable[(ang+2048)&2047])<<3); + yvect = -((mousex*(int)sintable[(ang+1536)&2047])<<3); + clipmove(&sprite[searchwall].x,&sprite[searchwall].y,&sprite[searchwall].z, + &cursectnum,xvect,yvect,128L,4L<<8,4L<<8,CLIPMASK1); + setsprite(searchwall,sprite[searchwall].x,sprite[searchwall].y,sprite[searchwall].z); + } + else + { + if (mouseaction==2)changedir*=-1; + while (updownunits--)sprite[searchwall].xrepeat = changechar(sprite[searchwall].xrepeat,changedir,smooshyalign,1); + if (sprite[searchwall].xrepeat < 4) + sprite[searchwall].xrepeat = 4; + Bsprintf(tempbuf,"Sprite %d repeat: %d, %d",searchwall,sprite[searchwall].xrepeat,sprite[searchwall].yrepeat); + message(tempbuf); + } + } + asksave = 1; + repeatcountx = max(1,repeatcountx-2); + } + repeatcountx += synctics; + } + else + repeatcountx = 0; + + updownunits=1; + mouseaction=0; + if (bstatus&1 && searchstat != 1 && searchstat != 2) + { + if (eitherSHIFT) + { + mskip=1; + if (mousey!=0) + { + mouseaction=1; + updownunits=klabs(mousey); + if (searchstat != 3) + { + updownunits=klabs(mousey*128./tilesizy[wall[searchwall].picnum]); + } + } + } + else + if (eitherCTRL) + { + mskip=1; + if (mousey!=0) + { + mouseaction=2; + repeatpanalign=0; + if (searchstat==3) + { + updownunits=klabs(mouseay+=mousey)/4; + if (updownunits)mouseay=0; + } + else + { + updownunits=klabs(mouseay+=mousey)/32; + if (updownunits)mouseay=0; + } + } + } + } + if (!mouseb) {mouseax=0;mouseay=0;} + if (keystatus[KEYSC_gUP] || keystatus[KEYSC_gDOWN] || mouseaction) // 2 & 8 (keypad) + { + if ((repeatcounty == 0) || (repeatcounty > 32) || mouseaction) + { + changedir = 0; + if (keystatus[KEYSC_gUP] || mousey>0) changedir = -1; + if (keystatus[KEYSC_gDOWN] || mousey<0) changedir = 1; + + if ((searchstat == 0) || (searchstat == 4)) + { + if (repeatpanalign == 0) + { + while (updownunits--)wall[searchwall].yrepeat = changechar(wall[searchwall].yrepeat,changedir,smooshyalign,1); + Bsprintf(tempbuf,"Wall %d repeat: %d, %d",searchwall,wall[searchwall].xrepeat,wall[searchwall].yrepeat); + } + else + { + while (updownunits--)wall[searchwall].ypanning = changechar(wall[searchwall].ypanning,changedir,smooshyalign,0); + Bsprintf(tempbuf,"Wall %d panning: %d, %d",searchwall,wall[searchwall].xpanning,wall[searchwall].ypanning); + } + message(tempbuf); + } + if ((searchstat == 1) || (searchstat == 2)) + { + if (searchstat == 1) + { + while (updownunits--)sector[searchsector].ceilingypanning = changechar(sector[searchsector].ceilingypanning,changedir,smooshyalign,0); + Bsprintf(tempbuf,"Sector %d ceiling panning: %d, %d",searchsector,sector[searchsector].ceilingxpanning,sector[searchsector].ceilingypanning); + } + else + { + while (updownunits--)sector[searchsector].floorypanning = changechar(sector[searchsector].floorypanning,changedir,smooshyalign,0); + Bsprintf(tempbuf,"Sector %d floor panning: %d, %d",searchsector,sector[searchsector].floorxpanning,sector[searchsector].floorypanning); + } + message(tempbuf); + } + if (searchstat == 3) + { + if (mouseaction==1) + { + int xvect,yvect; + short cursectnum=sprite[searchwall].sectnum; + xvect = -((mousey*(int)sintable[(ang+2560)&2047])<<3); + yvect = -((mousey*(int)sintable[(ang+2048)&2047])<<3); + clipmove(&sprite[searchwall].x,&sprite[searchwall].y,&sprite[searchwall].z, + &cursectnum,xvect,yvect,128L,4L<<8,4L<<8,CLIPMASK1); + setsprite(searchwall,sprite[searchwall].x,sprite[searchwall].y,sprite[searchwall].z); + } + else + { + while (updownunits--)sprite[searchwall].yrepeat = changechar(sprite[searchwall].yrepeat,changedir,smooshyalign,1); + if (sprite[searchwall].yrepeat < 4) + sprite[searchwall].yrepeat = 4; + Bsprintf(tempbuf,"Sprite %d repeat: %d, %d",searchwall,sprite[searchwall].xrepeat,sprite[searchwall].yrepeat); + message(tempbuf); + } + } + asksave = 1; + repeatcounty = max(1,repeatcounty-2); + } + repeatcounty += synctics; + } + else + repeatcounty = 0; + + if (keystatus[KEYSC_F11]) //F11 - brightness + { + extern short brightness; + + keystatus[KEYSC_F11] = 0; + brightness++; + if (brightness >= 16) brightness = 0; + setbrightness(brightness,palette,0); + Bsprintf(tempbuf,"Brightness %d out of 16",brightness); + message(tempbuf); + } + if (keystatus[KEYSC_F12]) //F12 + { + screencapture("captxxxx.tga",keystatus[KEYSC_LSHIFT]|keystatus[KEYSC_RSHIFT]); + message("Screenshot taken"); + keystatus[KEYSC_F12] = 0; + } + + if (keystatus[KEYSC_TAB]) //TAB + { + if (searchstat == 0) + { + temppicnum = wall[searchwall].picnum; + tempshade = wall[searchwall].shade; + temppal = wall[searchwall].pal; + tempxrepeat = wall[searchwall].xrepeat; + tempyrepeat = wall[searchwall].yrepeat; + tempcstat = wall[searchwall].cstat; + templotag = wall[searchwall].lotag; + temphitag = wall[searchwall].hitag; + tempextra = wall[searchwall].extra; + } + if (searchstat == 1) + { + temppicnum = sector[searchsector].ceilingpicnum; + tempshade = sector[searchsector].ceilingshade; + temppal = sector[searchsector].ceilingpal; + tempvis = sector[searchsector].visibility; + tempxrepeat = sector[searchsector].ceilingxpanning; + tempyrepeat = sector[searchsector].ceilingypanning; + tempcstat = sector[searchsector].ceilingstat; + templotag = sector[searchsector].lotag; + temphitag = sector[searchsector].hitag; + tempextra = sector[searchsector].extra; + } + if (searchstat == 2) + { + temppicnum = sector[searchsector].floorpicnum; + tempshade = sector[searchsector].floorshade; + temppal = sector[searchsector].floorpal; + tempvis = sector[searchsector].visibility; + tempxrepeat = sector[searchsector].floorxpanning; + tempyrepeat = sector[searchsector].floorypanning; + tempcstat = sector[searchsector].floorstat; + templotag = sector[searchsector].lotag; + temphitag = sector[searchsector].hitag; + tempextra = sector[searchsector].extra; + } + if (searchstat == 3) + { + temppicnum = sprite[searchwall].picnum; + tempshade = sprite[searchwall].shade; + temppal = sprite[searchwall].pal; + tempxrepeat = sprite[searchwall].xrepeat; + tempyrepeat = sprite[searchwall].yrepeat; + tempcstat = sprite[searchwall].cstat; + templotag = sprite[searchwall].lotag; + temphitag = sprite[searchwall].hitag; + tempextra = sprite[searchwall].extra; + } + if (searchstat == 4) + { + temppicnum = wall[searchwall].overpicnum; + tempshade = wall[searchwall].shade; + temppal = wall[searchwall].pal; + tempxrepeat = wall[searchwall].xrepeat; + tempyrepeat = wall[searchwall].yrepeat; + tempcstat = wall[searchwall].cstat; + templotag = wall[searchwall].lotag; + temphitag = wall[searchwall].hitag; + tempextra = wall[searchwall].extra; + } + somethingintab = searchstat; + keystatus[KEYSC_TAB] = 0; + } + + if (keystatus[KEYSC_ENTER]) + { + extern char pskysearch[MAXSECTORS]; + short daang;int dashade[2]; + if (eitherSHIFT) + { + if (((searchstat == 0) || (searchstat == 4)) && eitherCTRL) //Ctrl-shift Enter (auto-shade) + { + dashade[0] = 127; + dashade[1] = -128; + i = searchwall; + do + { + if ((int)wall[i].shade < dashade[0]) dashade[0] = wall[i].shade; + if ((int)wall[i].shade > dashade[1]) dashade[1] = wall[i].shade; + + i = wall[i].point2; + } + while (i != searchwall); + + daang = getangle(wall[wall[searchwall].point2].x-wall[searchwall].x,wall[wall[searchwall].point2].y-wall[searchwall].y); + i = searchwall; + do + { + j = getangle(wall[wall[i].point2].x-wall[i].x,wall[wall[i].point2].y-wall[i].y); + k = ((j+2048-daang)&2047); + if (k > 1024) + k = 2048-k; + wall[i].shade = dashade[0]+mulscale10(k,dashade[1]-dashade[0]); + + i = wall[i].point2; + } + while (i != searchwall); + Bsprintf(tempbuf,"Wall %d auto-shaded",searchwall); + message(tempbuf); + } + else if (somethingintab < 255) + { + if (searchstat == 0) wall[searchwall].shade = tempshade, wall[searchwall].pal = temppal; + if (searchstat == 1) + { + sector[searchsector].ceilingshade = tempshade, sector[searchsector].ceilingpal = temppal; + if ((somethingintab == 1) || (somethingintab == 2)) + sector[searchsector].visibility = tempvis; + } + if (searchstat == 2) + { + sector[searchsector].floorshade = tempshade, sector[searchsector].floorpal = temppal; + if ((somethingintab == 1) || (somethingintab == 2)) + sector[searchsector].visibility = tempvis; + } + if (searchstat == 3) sprite[searchwall].shade = tempshade, sprite[searchwall].pal = temppal; + if (searchstat == 4) wall[searchwall].shade = tempshade, wall[searchwall].pal = temppal; + message("Pasted shading+pal"); + } + } + else if (((searchstat == 0) || (searchstat == 4)) && eitherCTRL && (somethingintab < 255)) //Either ctrl key + { + i = searchwall; + do + { + wall[i].picnum = temppicnum; + wall[i].shade = tempshade; + wall[i].pal = temppal; + if ((somethingintab == 0) || (somethingintab == 4)) + { + wall[i].xrepeat = tempxrepeat; + wall[i].yrepeat = tempyrepeat; + wall[i].cstat = tempcstat; + } + fixrepeats((short)i); + i = wall[i].point2; + } + while (i != searchwall); + message("Pasted picnum+shading+pal"); + } + else if (((searchstat == 1) || (searchstat == 2)) && eitherCTRL && (somethingintab < 255)) //Either ctrl key + { + clearbuf(&pskysearch[0],(int)((numsectors+3)>>2),0L); + if (searchstat == 1) + { + i = searchsector; + if ((sector[i].ceilingstat&1) > 0) + pskysearch[i] = 1; + + while (pskysearch[i] == 1) + { + sector[i].ceilingpicnum = temppicnum; + sector[i].ceilingshade = tempshade; + sector[i].ceilingpal = temppal; + if ((somethingintab == 1) || (somethingintab == 2)) + { + sector[i].ceilingxpanning = tempxrepeat; + sector[i].ceilingypanning = tempyrepeat; + sector[i].ceilingstat = tempcstat; + } + pskysearch[i] = 2; + + startwall = sector[i].wallptr; + endwall = startwall + sector[i].wallnum - 1; + for (j=startwall;j<=endwall;j++) + { + k = wall[j].nextsector; + if (k >= 0) + if ((sector[k].ceilingstat&1) > 0) + if (pskysearch[k] == 0) + pskysearch[k] = 1; + } + + for (j=0;j 0) + pskysearch[i] = 1; + + while (pskysearch[i] == 1) + { + sector[i].floorpicnum = temppicnum; + sector[i].floorshade = tempshade; + sector[i].floorpal = temppal; + if ((somethingintab == 1) || (somethingintab == 2)) + { + sector[i].floorxpanning = tempxrepeat; + sector[i].floorypanning = tempyrepeat; + sector[i].floorstat = tempcstat; + } + pskysearch[i] = 2; + + startwall = sector[i].wallptr; + endwall = startwall + sector[i].wallnum - 1; + for (j=startwall;j<=endwall;j++) + { + k = wall[j].nextsector; + if (k >= 0) + if ((sector[k].floorstat&1) > 0) + if (pskysearch[k] == 0) + pskysearch[k] = 1; + } + + for (j=0;j 0) && (tilesizy[k] > 0)) + { + j = k; + break; + } + sprite[searchwall].picnum = j; + } + sprite[searchwall].shade = tempshade; + sprite[searchwall].pal = temppal; + if (somethingintab == 3) + { + sprite[searchwall].xrepeat = tempxrepeat; + sprite[searchwall].yrepeat = tempyrepeat; + if (sprite[searchwall].xrepeat < 1) sprite[searchwall].xrepeat = 1; + if (sprite[searchwall].yrepeat < 1) sprite[searchwall].yrepeat = 1; + sprite[searchwall].cstat = tempcstat; + sprite[searchwall].lotag = templotag; + sprite[searchwall].hitag = temphitag; + sprite[searchwall].extra = tempextra; + } + } + if (searchstat == 4) + { + wall[searchwall].overpicnum = temppicnum; + if (wall[searchwall].nextwall >= 0) + wall[wall[searchwall].nextwall].overpicnum = temppicnum; + wall[searchwall].shade = tempshade; + wall[searchwall].pal = temppal; + if (somethingintab == 4) + { + wall[searchwall].xrepeat = tempxrepeat; + wall[searchwall].yrepeat = tempyrepeat; + wall[searchwall].cstat = tempcstat; + wall[searchwall].lotag = templotag; + wall[searchwall].hitag = temphitag; + wall[searchwall].extra = tempextra; + } + fixrepeats(searchwall); + } + message("Pasted clipboard"); + } + asksave = 1; + keystatus[KEYSC_ENTER] = 0; + } + + if (keystatus[KEYSC_C]) + { + keystatus[KEYSC_C] = 0; + if (eitherALT) + { + if (somethingintab < 255) + { + switch (searchstat) + { + case 0: + j = wall[searchwall].picnum; + for (i=0;i getmessagetimeoff) && (totalclock > (lastpm16time + 120*3))) { - updatesector(mousxplc,mousyplc,&cursectornum); if (pointhighlight >= 16384) { char tmpbuf[2048]; @@ -4539,6 +5651,14 @@ static void Keys2d(void) /* start Mapster32 */ + if (keystatus[KEYSC_F4]) + { + showfirstwall = !showfirstwall; + Bsprintf(tempbuf,"Show first wall %s",showfirstwall?"ON":"OFF"); + message(tempbuf); + keystatus[KEYSC_F4] = 0; + } + if (keystatus[KEYSC_M]) // M (tag) { keystatus[KEYSC_M] = 0; @@ -5563,7 +6683,7 @@ static int registerosdcommands(void) OSD_RegisterFunction("pk_quickmapcycling", "pk_quickmapcycling: allows cycling of maps with (Shift-)Ctrl-X", osdcmd_vars_pk); return 0; } - +#define DUKEOSD #ifdef DUKEOSD void GAME_drawosdchar(int x, int y, char ch, int shade, int pal) { @@ -5636,23 +6756,25 @@ void GAME_clearbackground(int c, int r) int x, y, xsiz, ysiz, tx2, ty2; int daydim, bits; -#ifdef _WIN32 - if (qsetmode != 200) - { - OSD_SetFunctions( - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - (int(*)(void))GetTime, - NULL - ); - return; - } -#endif - + UNREFERENCED_PARAMETER(c); + /* + #ifdef _WIN32 + if (qsetmode != 200) + { + OSD_SetFunctions( + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + (int(*)(void))GetTime, + NULL + ); + return; + } + #endif + */ if (getrendermode() < 3) bits = BITS; else bits = BITSTL; @@ -6183,12 +7305,11 @@ void app_crashhandler(void) f = strrchr(levelname, '/'); if (!f) f = levelname; else f++; } + f=strstr(levelname,".map"); + if (f)Bstrcpy(f,"_crash.map");else Bstrcat(f,"_crash.map"); ExtPreSaveMap(); - saveboard(f,&startposx,&startposy,&startposz,&startang,&startsectnum); - ExtSaveMap(f); - message("Board saved"); - asksave = 0; - keystatus[0x1f] = 0; + saveboard(levelname,&startposx,&startposy,&startposz,&startang,&startsectnum); + ExtSaveMap(levelname); } } #endif @@ -6398,29 +7519,78 @@ static void Keys2d3d(void) } if (eitherCTRL) //CTRL + { + char *f; + if (pathsearchmode) f = levelname; + else + { + // virtual filesystem mode can't save to directories so drop the file into + // the current directory + f = strrchr(levelname, '/'); + if (!f) f = levelname; else f++; + } + if (keystatus[KEYSC_S]) // S { if (levelname[0]) { - char *f; fixspritesectors(); //Do this before saving! updatesector(startposx,startposy,&startsectnum); - if (pathsearchmode) f = levelname; - else - { - // virtual filesystem mode can't save to directories so drop the file into - // the current directory - f = strrchr(levelname, '/'); - if (!f) f = levelname; else f++; - } ExtPreSaveMap(); saveboard(f,&startposx,&startposy,&startposz,&startang,&startsectnum); ExtSaveMap(f); message("Board saved"); asksave = 0; keystatus[KEYSC_S] = 0; + lastsave=totalclock; } } + if (keystatus[KEYSC_L]) // L + { + extern int grponlymode; + extern void loadmhk(); + + if (totalclock < (lastsave + 120*10) || !AskIfSure("Are you sure you want to load the last saved map?")) + { + int sposx=posx,sposy=posy,sposz=posz,sang=ang; + + lastsave=totalclock; + highlightcnt = -1; +// sectorhighlightstat = -1; +// newnumwalls = -1; +// joinsector[0] = -1; +// circlewall = -1; +// circlepoints = 7; + + for (i=0;i>6)+2,((i/charsperline)<<3)+(ydimgame-(ydimgame>>3))-(((getmessageleng-1)/charsperline)<<3)+2,0,-1,tempbuf,xdimgame>640?0:1); - printext256((xdimgame>>6),((i/charsperline)<<3)+(ydimgame-(ydimgame>>3))-(((getmessageleng-1)/charsperline)<<3),whitecol,-1,tempbuf,xdimgame>640?0:1); + printext256((xdimgame>>1)+2,((i/charsperline)<<3)+(ydimgame-(ydimgame>>3))-(((getmessageleng-1)/charsperline)<<3)+2,0,-1,tempbuf,xdimgame>640?0:1); + printext256((xdimgame>>1),((i/charsperline)<<3)+(ydimgame-(ydimgame>>3))-(((getmessageleng-1)/charsperline)<<3), + (totalclock > (lastmessagetime + 120*5))?whitecol:256-5,-1,tempbuf,xdimgame>640?0:1); } enddrawing(); } @@ -6496,7 +7667,7 @@ void ExtCheckKeys(void) if (sidemode != 1) { editinput(); - m32_showmouse(); + if (infobox)m32_showmouse(); } return; } diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index f7c29b404..253c43989 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -6676,6 +6676,10 @@ void animatesprites(int x,int y,int a,int smoothratio) #if defined(POLYMOST) && defined(USE_OPENGL) if (bpp > 8 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) { + int v=getangle(t->xvel,t->zvel>>4); + if (v>1023)v-=2048; + spriteext[i].pitch=v; + t->cstat &= ~4; break; } diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index 31cb1515d..68c415840 100755 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -172,7 +172,7 @@ int ReadGameVars(int fil) { //Bsprintf(g_szBuf,"Reading value array for %s (%d)",aGameVars[i].szLabel,sizeof(int) * MAXPLAYERS); //AddLog(g_szBuf); - if (kdfread(aGameArrays[i].plValues,sizeof(intptr_t) * aGameArrays[i].size, 1, fil) != 1) goto corrupt; + if (kdfread(aGameArrays[i].plValues,sizeof(intptr_t) * aGameArrays[i].size, 1, fil) < 1) goto corrupt; } // Bsprintf(g_szBuf,"CP:%s %d",__FILE__,__LINE__); diff --git a/polymer/eduke32/source/mapster32.h b/polymer/eduke32/source/mapster32.h index 5f22fd454..946ab5184 100644 --- a/polymer/eduke32/source/mapster32.h +++ b/polymer/eduke32/source/mapster32.h @@ -1,203 +1,205 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2004, 2007 - EDuke32 developers - -This file is part of EDuke32 - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//------------------------------------------------------------------------- - -#include "compat.h" - -#define TICSPERFRAME 3 - -// #define VULGARITY - -char *defsfilename = "duke3d.def"; - -extern char keystatus[]; -extern short defaultspritecstat; -extern int posx, posy, posz, horiz, qsetmode; -extern short ang, cursectnum; -extern short ceilingheinum, floorheinum; -extern char names[MAXTILES][25]; - -extern int ydim16, xdimgame, ydimgame, bppgame, xdim2d, ydim2d; - -extern int zmode, kensplayerheight, zlock; - -extern short editstatus, searchit; -extern int searchx, searchy, osearchx, osearchy; //search input -extern short searchsector, searchwall, searchstat; //search output - -extern short temppicnum, tempcstat, templotag, temphitag, tempextra; -extern unsigned char tempshade, temppal, tempvis, tempxrepeat, tempyrepeat, somethingintab; - -static int ototalclock = 0, clockval[16], clockcnt = 0; - -#define NUMOPTIONS 9 -#define NUMKEYS 19 - -char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0}; -unsigned char keys[NUMBUILDKEYS] = - { - 0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39, - 0x1e,0x2c,0xd1,0xc9,0x47,0x49, - 0x9c,0x1c,0xd,0xc,0xf,0x29 - }; - -int nextvoxid = 0; - -extern int whitecol; -extern char vgapal16[4*256]; -extern void AutoAlignWalls(int nWall0, int ply); -extern char changechar(char dachar, int dadir, char smooshyalign, char boundcheck); -extern void _printmessage16(char name[82]); -extern void updatenumsprites(void); - -extern int lastpm16time, synctics; -extern int halfxdim16, midydim16, zoom; -extern void fixrepeats(short i); - -char autospritehelp=0,autosecthelp=0; -short MinRate=24, MinD=3; -int xoldtimerhandler, lastmessagetime; - -char tempbuf[1024]; //1024 -int numsprite[MAXSPRITES]; -int multisprite[MAXSPRITES]; -char lo[32]; -char levelname[255]; -short curwall=0,curwallnum=0; -short cursearchsprite=0,cursearchspritenum=0,cursector_lotag=0,cursectornum=0; -short search_lotag=0,search_hitag=0; -char wallsprite=0; -char helpon=0; -//static char onwater=0; -unsigned char onnames=4, usedcount=1; -short cursprite; -int mousxplc, mousyplc, ppointhighlight; -int counter=0; -unsigned char nosprites=0,purpleon=0,skill=4; -unsigned char framerateon=1,tabgraphic=2,shadepreview=0,autosave=1,sidemode=0; -extern int vel, svel, hvel, angvel; -int xvel, yvel, timoff; - -static void SearchSectorsForward(); -static void SearchSectorsBackward(); -static inline void SpriteName(short spritenum, char *lo2); -static void PrintStatus(char *string,int num,char x,char y,char color); -static void SetBOSS1Palette(); -// static void SetSLIMEPalette(); -static void SetWATERPalette(); -static void SetGAMEPalette(); -static void kensetpalette(char *vgapal); - -extern short grid; - -static void EditSpriteData(short spritenum); -static void EditWallData(short wallnum); -static void EditSectorData(short sectnum); -static void FuncMenu(void); - -char GAMEpalette[768]; -char WATERpalette[768]; -char SLIMEpalette[768]; -char TITLEpalette[768]; -char REALMSpalette[768]; -char BOSS1palette[768]; - -char num_tables; - -int updownunits=1024; -extern short highlightsector[MAXSECTORS], highlightsectorcnt; -extern short highlight[MAXWALLS]; -extern short pointhighlight, linehighlight, highlightcnt; -extern short asksave; - -char getmessage[162], getmessageleng; -int getmessagetimeoff, charsperline; -extern int startposx, startposy, startposz; -extern short startang, startsectnum; - -int autosavetimer; -extern int numsprites; -extern char spritecol2d[MAXTILES][2]; -extern char custom2dcolors; -extern char mlook; - -int intro=0; -extern int ydim16, halfxdim16, midydim16, zoom; -extern intptr_t frameplace; -extern char pow2char[8]; - -static int acurpalette=0; - -extern void showsectordata(short sectnum); -extern void showwalldata(short wallnum); -extern void showspritedata(short spritenum); -extern int checksectorpointer(short i, short sectnum); - -extern double msens; - -void ContextHelp(short spritenum); -void ResetKeys(); - -extern void fixspritesectors(void); - #define KEY_PRESSED(sc) KB_KeyPressed((sc)) - -// This table defines the various zoom levels, the numbers being the pixel width -// and height of the sprite when plotted on the screen. Probably zooms in too far -// for some, but I'm a blind old git :-( - -#define FUCKING_GOOD_EYESIGHT 16 - -static const int ZoomToThumbSize[] = -{ - FUCKING_GOOD_EYESIGHT, 32, 64, 128, 192, 256, 384, 512 -} ; - -#define NUM_ZOOMS (sizeof(ZoomToThumbSize)/sizeof(ZoomToThumbSize[0])) - -#define INITIAL_ZOOM 2 - -typedef struct -{ - int *pIds ; // ptr to list of tile Ids - int nIds ; // num of tile ids - char *szText ; // description to present to user. - char key1 ; // key1 and key2 are two alternative keypresses used to - char key2 ; // select tile set. Bodge to do eary upper/lower case handling -} TileGroup; - -#define MAX_TILE_GROUPS 32 -#define MAX_TILE_GROUP_ENTRIES 1024 - -TileGroup s_TileGroups[MAX_TILE_GROUPS]; - -static unsigned int tile_groups = 0; - -#define FIRST_USER_ART_TILE 3584 -// Some atomic tiles are sprinkled in the V1.3d's area but -// this is where the main atomic tiles start :- -#define FIRST_ATOMIC_TILE 4096 -#define FIRST_EXTENDED_TILE 6144 -#define SECOND_EXTENDED_TILE 9216 - -extern short localartfreq[MAXTILES]; -extern short localartlookup[MAXTILES], localartlookupnum; -extern int lockclock; -extern void clearkeys(void); +//------------------------------------------------------------------------- +/* +Copyright (C) 2004, 2007 - EDuke32 developers + +This file is part of EDuke32 + +EDuke32 is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License version 2 +as published by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +//------------------------------------------------------------------------- + +#include "compat.h" + +#define TICSPERFRAME 3 + +// #define VULGARITY + +char *defsfilename = "duke3d.def"; + +extern char keystatus[]; +extern short defaultspritecstat; +extern int posx, posy, posz, horiz, qsetmode; +extern short ang, cursectnum; +extern short ceilingheinum, floorheinum; +extern char names[MAXTILES][25]; + +extern int ydim16, xdimgame, ydimgame, bppgame, xdim2d, ydim2d; + +extern int zmode, kensplayerheight, zlock; + +extern short editstatus, searchit; +extern int searchx, searchy, osearchx, osearchy; //search input +extern short searchsector, searchwall, searchstat; //search output + +extern short temppicnum, tempcstat, templotag, temphitag, tempextra; +extern unsigned char temppal, tempvis, tempxrepeat, tempyrepeat, somethingintab; +extern signed char tempshade; + +static int ototalclock = 0, clockval[16], clockcnt = 0; + +#define NUMOPTIONS 9 +#define NUMKEYS 19 + +char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0}; +unsigned char keys[NUMBUILDKEYS] = + { + 0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39, + 0x1e,0x2c,0xd1,0xc9,0x47,0x49, + 0x9c,0x1c,0xd,0xc,0xf,0x29 + }; + +int nextvoxid = 0; + +extern int whitecol; +extern char vgapal16[4*256]; +extern void AutoAlignWalls(int nWall0, int ply); +extern char changechar(char dachar, int dadir, char smooshyalign, char boundcheck); +extern void _printmessage16(char name[82]); +extern void updatenumsprites(void); + +extern int lastpm16time, synctics; +extern int halfxdim16, midydim16, zoom; +extern void fixrepeats(short i); + +char autospritehelp=0,autosecthelp=0; +short MinRate=24, MinD=3; +int xoldtimerhandler, lastmessagetime=-1; + +char tempbuf[1024]; //1024 +int numsprite[MAXSPRITES]; +int multisprite[MAXSPRITES]; +char lo[32]; +char levelname[255]; +short curwall=0,curwallnum=0; +short cursearchsprite=0,cursearchspritenum=0,cursector_lotag=0,cursectornum=0; +short search_lotag=0,search_hitag=0; +char wallsprite=0; +char helpon=0; +//static char onwater=0; +unsigned char onnames=4, usedcount=1; +short cursprite; +int mousxplc, mousyplc, ppointhighlight; +int counter=0; +unsigned char nosprites=0,purpleon=0,skill=4; +unsigned char framerateon=1,tabgraphic=2,shadepreview=0,autosave=1,sidemode=0; +extern int vel, svel, hvel, angvel; +int xvel, yvel, timoff; + +static void SearchSectorsForward(); +static void SearchSectorsBackward(); +static inline void SpriteName(short spritenum, char *lo2); +static void PrintStatus(char *string,int num,char x,char y,char color); +static void SetBOSS1Palette(); +// static void SetSLIMEPalette(); +static void SetWATERPalette(); +static void SetGAMEPalette(); +static void kensetpalette(char *vgapal); + +extern short grid; + +static void EditSpriteData(short spritenum); +static void EditWallData(short wallnum); +static void EditSectorData(short sectnum); +static void FuncMenu(void); + +char GAMEpalette[768]; +char WATERpalette[768]; +char SLIMEpalette[768]; +char TITLEpalette[768]; +char REALMSpalette[768]; +char BOSS1palette[768]; + +char num_tables; + +int updownunits=1024; +extern short highlightsector[MAXSECTORS], highlightsectorcnt; +extern short highlight[MAXWALLS]; +extern short pointhighlight, linehighlight, highlightcnt; +extern short asksave; + +char getmessage[162], getmessageleng; +int getmessagetimeoff, charsperline; +extern int startposx, startposy, startposz; +extern short startang, startsectnum; + +int autosavetimer; +extern int numsprites; +extern int showfirstwall; +extern char spritecol2d[MAXTILES][2]; +extern char custom2dcolors; +extern char mlook; + +int intro=0; +extern int ydim16, halfxdim16, midydim16, zoom; +extern intptr_t frameplace; +extern char pow2char[8]; + +static int acurpalette=0; + +extern void showsectordata(short sectnum); +extern void showwalldata(short wallnum); +extern void showspritedata(short spritenum); +extern int checksectorpointer(short i, short sectnum); + +extern double msens; + +void ContextHelp(short spritenum); +void ResetKeys(); + +extern void fixspritesectors(void); + #define KEY_PRESSED(sc) KB_KeyPressed((sc)) + +// This table defines the various zoom levels, the numbers being the pixel width +// and height of the sprite when plotted on the screen. Probably zooms in too far +// for some, but I'm a blind old git :-( + +#define FUCKING_GOOD_EYESIGHT 16 + +static const int ZoomToThumbSize[] = +{ + FUCKING_GOOD_EYESIGHT, 32, 64, 128, 192, 256, 384, 512 +} ; + +#define NUM_ZOOMS (sizeof(ZoomToThumbSize)/sizeof(ZoomToThumbSize[0])) + +#define INITIAL_ZOOM 2 + +typedef struct +{ + int *pIds ; // ptr to list of tile Ids + int nIds ; // num of tile ids + char *szText ; // description to present to user. + char key1 ; // key1 and key2 are two alternative keypresses used to + char key2 ; // select tile set. Bodge to do eary upper/lower case handling +} TileGroup; + +#define MAX_TILE_GROUPS 32 +#define MAX_TILE_GROUP_ENTRIES 1024 + +TileGroup s_TileGroups[MAX_TILE_GROUPS]; + +static unsigned int tile_groups = 0; + +#define FIRST_USER_ART_TILE 3584 +// Some atomic tiles are sprinkled in the V1.3d's area but +// this is where the main atomic tiles start :- +#define FIRST_ATOMIC_TILE 4096 +#define FIRST_EXTENDED_TILE 6144 +#define SECOND_EXTENDED_TILE 9216 + +extern short localartfreq[MAXTILES]; +extern short localartlookup[MAXTILES], localartlookupnum; +extern int lockclock; +extern void clearkeys(void);