From a5d9881709445a4f87f14e1db80b515a40b7ffe3 Mon Sep 17 00:00:00 2001 From: terminx Date: Wed, 3 Sep 2008 11:59:54 +0000 Subject: [PATCH] Adds getnumberptr256() which lets us update the map in real time based on the number typed in This is good for stuff like palettes, shades, sector visibility, et cetera where the user might want to see the results of a change before committing to it git-svn-id: https://svn.eduke32.com/eduke32@1050 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/src/build.c | 1521 -------------------------------- polymer/eduke32/eduke32.vcproj | 4 + polymer/eduke32/source/astub.c | 187 +++- 3 files changed, 158 insertions(+), 1554 deletions(-) diff --git a/polymer/build/src/build.c b/polymer/build/src/build.c index 7e0fcede1..7197f1a52 100644 --- a/polymer/build/src/build.c +++ b/polymer/build/src/build.c @@ -905,1528 +905,7 @@ 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 (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) - { - 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) - { - 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) //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 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; - } - 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 = 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: - 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) - { - 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; diff --git a/polymer/eduke32/eduke32.vcproj b/polymer/eduke32/eduke32.vcproj index d903387e2..aaa24a410 100644 --- a/polymer/eduke32/eduke32.vcproj +++ b/polymer/eduke32/eduke32.vcproj @@ -482,6 +482,10 @@ RelativePath=".\source\gameexec.c" > + + diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index cb3ba3e05..3987418f8 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -1311,8 +1311,8 @@ HELPFILE_ERROR: return; } -// this obviously sucks but it works -#define IHELP_NUMDISPLINES ((overridepm16y>>4)+(overridepm16y>>5)+(overridepm16y>>7)-2) +// why can't MSVC allocate an array of variable size?! +#define IHELP_NUMDISPLINES 42 // ((overridepm16y>>4)+(overridepm16y>>5)+(overridepm16y>>7)-2) #define IHELP_PATLEN 45 extern int overridepm16y; // influences printmessage16() and clearmidstatbar16() @@ -3025,6 +3025,143 @@ void drawtileinfo(char *title,int x,int y,int picnum,int shade,int pal,int cstat } int snap=0;int saveval1,saveval2,saveval3; +void getnumber_dochar(char *ptr, int num) +{ + *ptr = (char) num; +} + +void getnumber_doshort(short *ptr, int num) +{ + *ptr = (short) num; +} + +void getnumber_doint32(int32 *ptr, int num) +{ + *ptr = (int32) num; +} + +void getnumber_doint64(int64 *ptr, int num) +{ + *ptr = (int64) num; +} + + +void getnumberptr256(char namestart[80], void *num, int bits, int maxnumber, char sign, void *(func)(int)) +{ + char buffer[80], ch; + int n, danum = 0, oldnum; + + switch (bits) + { + case 1: + danum = *(char *)num; + break; + case 2: + danum = *(short *)num; + break; + case 4: + danum = *(int32 *)num; + break; + case 8: + danum = *(int64 *)num; + break; + } + + oldnum = danum; + bflushchars(); + while (keystatus[0x1] == 0) + { + if (handleevents()) + { + if (quitevent) quitevent = 0; + } + + drawrooms(posx,posy,posz,ang,horiz,cursectnum); +#ifdef SUPERBUILD + ExtAnalyzeSprites(); +#endif + drawmasks(); + + ch = bgetchar(); + + if (keystatus[0x1]) break; + + clearkeys(); + + ExtCheckKeys(); + + if (func != NULL) + Bsprintf(buffer,"%s%s",namestart,(char *)func((int)danum)); + else Bsprintf(buffer,"%s%d",namestart,danum); + + if (totalclock & 32) Bstrcat(buffer,"_ "); + printmessage256(buffer); + showframe(1); + + if (ch >= '0' && ch <= '9') + { + if (danum >= 0) + { + n = (danum*10)+(ch-'0'); + if (n <= maxnumber) danum = n; + } + else if (sign) + { + n = (danum*10)-(ch-'0'); + if (n >= -maxnumber) danum = n; + } + } + else if (ch == 8 || ch == 127) // backspace + { + danum /= 10; + } + else if (ch == 13) + { + oldnum = danum; + asksave = 1; + break; + } + else if (ch == '-' && sign) // negate + { + danum = -danum; + } + switch (bits) + { + case 1: + getnumber_dochar(num, danum); + break; + case 2: + getnumber_doshort(num, danum); + break; + case 4: + getnumber_doint32(num, danum); + break; + case 8: + getnumber_doint64(num, danum); + break; + } + } + clearkeys(); + + lockclock = totalclock; //Reset timing + + switch (bits) + { + case 1: + getnumber_dochar(num, oldnum); + break; + case 2: + getnumber_doshort(num, oldnum); + break; + case 4: + getnumber_doint32(num, oldnum); + break; + case 8: + getnumber_doint64(num, oldnum); + break; + } +} + static void Keys3d(void) { int i,count,rate,nexti,changedir; @@ -3203,8 +3340,7 @@ static void Keys3d(void) { case 1: case 2: - sector[searchsector].visibility = - getnumber256("Sector visibility: ",sector[searchsector].visibility,256L,0); + getnumberptr256("Sector visibility: ",§or[searchsector].visibility,sizeof(sector[searchsector].visibility),256L,0,NULL); break; } } @@ -4803,21 +4939,16 @@ static void Keys3d(void) { case 0: case 4: - wall[searchwall].shade = - getnumber256("Wall shade: ",wall[searchwall].shade,128L,1); + getnumberptr256("Wall shade: ",&wall[searchwall].shade,sizeof(wall[searchwall].shade),128L,1,NULL); break; case 1: + getnumberptr256("Ceiling shade: ",§or[searchsector].ceilingshade,sizeof(sector[searchsector].ceilingshade),128L,1,NULL); + break; case 2: - if (searchstat==1) - sector[searchsector].ceilingshade = - getnumber256("Ceiling shade: ",sector[searchsector].ceilingshade,128L,1); - if (searchstat==2) - sector[searchsector].floorshade = - getnumber256("Floor shade: ",sector[searchsector].floorshade,128L,1); + getnumberptr256("Floor shade: ",§or[searchsector].floorshade,sizeof(sector[searchsector].floorshade),128L,1,NULL); break; case 3: - sprite[searchwall].shade = - getnumber256("Sprite shade: ",sprite[searchwall].shade,128L,1); + getnumberptr256("Sprite shade: ",&sprite[searchwall].shade,sizeof(sprite[searchwall].shade),128L,1,NULL); break; } } @@ -4875,29 +5006,19 @@ static void Keys3d(void) switch (searchstat) { case 0: - i = getnumber256("Wall picnum: ",wall[searchwall].picnum,MAXTILES-1,0); - if (tilesizx[i] != 0) - wall[searchwall].picnum = i; + getnumberptr256("Wall picnum: ",&wall[searchwall].picnum,sizeof(wall[searchwall].picnum),MAXTILES-1,0,NULL); break; case 1: - i = getnumber256("Sector ceiling picnum: ",sector[searchsector].ceilingpicnum,MAXTILES-1,0); - if (tilesizx[i] != 0) - sector[searchsector].ceilingpicnum = i; + getnumberptr256("Sector ceiling picnum: ",§or[searchsector].ceilingpicnum,sizeof(sector[searchsector].ceilingpicnum),MAXTILES-1,0,NULL); break; case 2: - i = getnumber256("Sector floor picnum: ",sector[searchsector].floorpicnum,MAXTILES-1,0); - if (tilesizx[i] != 0) - sector[searchsector].floorpicnum = i; + getnumberptr256("Sector floor picnum: ",§or[searchsector].floorpicnum,sizeof(sector[searchsector].floorpicnum),MAXTILES-1,0,NULL); break; case 3: - i = getnumber256("Sprite picnum: ",sprite[searchwall].picnum,MAXTILES-1,0); - if (tilesizx[i] != 0) - sprite[searchwall].picnum = i; + getnumberptr256("Sprite picnum: ",&sprite[searchwall].picnum,sizeof(sprite[searchwall].picnum),MAXTILES-1,0,NULL); break; case 4: - i = getnumber256("Masked wall picnum: ",wall[searchwall].overpicnum,MAXTILES-1,0); - if (tilesizx[i] != 0) - wall[searchwall].overpicnum = i; + getnumberptr256("Masked wall picnum: ",&wall[searchwall].overpicnum,sizeof(wall[searchwall].overpicnum),MAXTILES-1,0,NULL); break; } asksave = 1; @@ -5931,19 +6052,19 @@ static void Keys3d(void) case 0: case 4: Bstrcpy(buffer,"Wall pal: "); - wall[searchwall].pal = getnumber256(buffer,wall[searchwall].pal,256L,0); + getnumberptr256(buffer,&wall[searchwall].pal,sizeof(wall[searchwall].pal),256L,0,NULL); break; case 1: Bstrcpy(buffer,"Ceiling pal: "); - sector[searchsector].ceilingpal = getnumber256(buffer,sector[searchsector].ceilingpal,256L,0); + getnumberptr256(buffer,§or[searchsector].ceilingpal,sizeof(sector[searchsector].ceilingpal),256L,0,NULL); break; case 2: Bstrcpy(buffer,"Floor pal: "); - sector[searchsector].floorpal = getnumber256(buffer,sector[searchsector].floorpal,256L,0); + getnumberptr256(buffer,§or[searchsector].floorpal,sizeof(sector[searchsector].floorpal),256L,0,NULL); break; case 3: Bstrcpy(buffer,"Sprite pal: "); - sprite[searchwall].pal = getnumber256(buffer,sprite[searchwall].pal,256L,0); + getnumberptr256(buffer,&sprite[searchwall].pal,sizeof(sprite[searchwall].pal),256L,0,NULL); break; } }