From 26de39bc2ee6606539e5b6a4da5356d777b921a2 Mon Sep 17 00:00:00 2001 From: terminx Date: Fri, 16 May 2008 00:23:33 +0000 Subject: [PATCH] Cleanup patch from Hunter_rus git-svn-id: https://svn.eduke32.com/eduke32@727 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/include/editor.h | 21 ++ polymer/build/src/build.c | 212 +++++------ polymer/eduke32/source/astub.c | 626 ++++++++++++++++++--------------- polymer/eduke32/source/keys.h | 187 +++++----- 4 files changed, 577 insertions(+), 469 deletions(-) diff --git a/polymer/build/include/editor.h b/polymer/build/include/editor.h index 79e80bc75..d9bedadd5 100644 --- a/polymer/build/include/editor.h +++ b/polymer/build/include/editor.h @@ -9,6 +9,27 @@ extern "C" { #endif +// Build keys +#define BK_MOVEFORWARD 0 +#define BK_MOVEBACKWARD 1 +#define BK_TURNLEFT 2 +#define BK_TURNRIGHT 3 +#define BK_RUN 4 +#define BK_STRAFE 5 +#define BK_SHOOT 6 +#define BK_OPEN 7 +#define BK_MOVEUP 8 +#define BK_MOVEDOWN 9 +#define BK_LOOKUP 10 +#define BK_LOOKDOWN 11 +#define BK_STRAFELEFT 12 +#define BK_STRAFERIGHT 13 +#define BK_MODE2D_3D 14 +#define BK_PLAYERVIEW 15 +#define BK_ZOOMIN 16 +#define BK_ZOOMOUT 17 +#define BK_MESSAGE 18 +#define BK_CONSOLE 19 #define NUMBUILDKEYS 20 extern int qsetmode; diff --git a/polymer/build/src/build.c b/polymer/build/src/build.c index f276ab2da..27bac8992 100644 --- a/polymer/build/src/build.c +++ b/polymer/build/src/build.c @@ -427,7 +427,7 @@ int app_main(int argc, const char **argv) { setbrightness(0,palette,0); overheadeditor(); - keystatus[buildkeys[14]] = 0; + keystatus[buildkeys[BK_MODE2D_3D]] = 0; } CANCEL: quitflag = 0; @@ -458,7 +458,7 @@ CANCEL: synctics = totalclock-lockclock; lockclock += synctics; - if (keystatus[1] > 0) + if (keystatus[1]) { keystatus[1] = 0; begindrawing(); //{{{ @@ -481,7 +481,7 @@ CANCEL: } idle(); - if (keystatus[0x15] != 0) + if (keystatus[0x15]) { keystatus[0x15] = 0; quitflag = 1; break; @@ -507,7 +507,7 @@ CANCEL: if (handleevents()) { if (quitevent) break; } // like saying no idle(); - if (keystatus[0x15] != 0) + if (keystatus[0x15]) { char *f; keystatus[0x15] = 0; @@ -720,20 +720,20 @@ void editinput(void) showmouse(); - if (keystatus[0x3b] > 0) posx--; - if (keystatus[0x3c] > 0) posx++; - if (keystatus[0x3d] > 0) posy--; - if (keystatus[0x3e] > 0) posy++; +// if (keystatus[0x3b] > 0) posx--; +// if (keystatus[0x3c] > 0) posx++; +// if (keystatus[0x3d] > 0) posy--; +// if (keystatus[0x3e] > 0) posy++; // if (keystatus[0x43] > 0) ang--; // if (keystatus[0x44] > 0) ang++; - if (keystatus[0x43] > 0) + if (keystatus[0x43]) { mhk=1; loadmhk(); keystatus[0x43] = 0; } - if (keystatus[0x44] > 0) + if (keystatus[0x44]) { memset(spriteext, 0, sizeof(spriteexttype) * MAXSPRITES); memset(spritesmooth, 0, sizeof(spritesmooth)); @@ -749,7 +749,7 @@ void editinput(void) { //ENGINE calculates angvel for you doubvel = synctics; - if (keystatus[buildkeys[4]] > 0) //Lt. shift makes turn velocity 50% faster + if (keystatus[buildkeys[BK_RUN]]) //Lt. shift makes turn velocity 50% faster doubvel += (synctics>>1); ang += ((angvel*doubvel)>>4); ang = (ang+2048)&2047; @@ -757,7 +757,7 @@ void editinput(void) if ((vel|svel) != 0) { doubvel = synctics; - if (keystatus[buildkeys[4]] > 0) //Lt. shift doubles forward velocity + if (keystatus[buildkeys[BK_RUN]]) //Lt. shift doubles forward velocity doubvel += synctics; xvect = 0, yvect = 0; if (vel != 0) @@ -795,25 +795,25 @@ void editinput(void) if (goalz < hiz+(16<<8)) //ceiling&floor too close goalz = ((loz+hiz)>>1); goalz += mousz; - if (keystatus[buildkeys[8]] > 0) //A (stand high) + if (keystatus[buildkeys[BK_MOVEUP]]) //A (stand high) { - if ((keystatus[0x1d]|keystatus[0x9d]) > 0) - horiz = max(-100,horiz-((keystatus[buildkeys[4]]+1)*synctics*2)); + if (keystatus[0x1d]|keystatus[0x9d]) + horiz = max(-100,horiz-((keystatus[buildkeys[BK_RUN]]+1)*synctics*2)); else { goalz -= (16<<8); - if (keystatus[buildkeys[4]] > 0) //Either shift key + if (keystatus[buildkeys[BK_RUN]]) //Either shift key goalz -= (24<<8); } } - if (keystatus[buildkeys[9]] > 0) //Z (stand low) + if (keystatus[buildkeys[BK_MOVEDOWN]]) //Z (stand low) { - if ((keystatus[0x1d]|keystatus[0x9d]) > 0) - horiz = min(300,horiz+((keystatus[buildkeys[4]]+1)*synctics*2)); + if (keystatus[0x1d]|keystatus[0x9d]) + horiz = min(300,horiz+((keystatus[buildkeys[BK_RUN]]+1)*synctics*2)); else { goalz += (12<<8); - if (keystatus[buildkeys[4]] > 0) //Either shift key + if (keystatus[buildkeys[BK_RUN]]) //Either shift key goalz += (12<<8); } } @@ -831,11 +831,11 @@ void editinput(void) else { goalz = posz; - if (keystatus[buildkeys[8]] > 0) //A + if (keystatus[buildkeys[BK_MOVEUP]]) //A { - if ((keystatus[0x1d]|keystatus[0x9d]) > 0) + if (keystatus[0x1d]|keystatus[0x9d]) { - horiz = max(-100,horiz-((keystatus[buildkeys[4]]+1)*synctics*2)); + horiz = max(-100,horiz-((keystatus[buildkeys[BK_RUN]]+1)*synctics*2)); } else { @@ -844,15 +844,15 @@ void editinput(void) else { zlock += (4<<8); - keystatus[buildkeys[8]] = 0; + keystatus[buildkeys[BK_MOVEUP]] = 0; } } } - if (keystatus[buildkeys[9]] > 0) //Z (stand low) + if (keystatus[buildkeys[BK_MOVEDOWN]]) //Z (stand low) { - if ((keystatus[0x1d]|keystatus[0x9d]) > 0) + if (keystatus[0x1d]|keystatus[0x9d]) { - horiz = min(300,horiz+((keystatus[buildkeys[4]]+1)*synctics*2)); + horiz = min(300,horiz+((keystatus[buildkeys[BK_RUN]]+1)*synctics*2)); } else { @@ -861,7 +861,7 @@ void editinput(void) else if (zlock > 0) { zlock -= (4<<8); - keystatus[buildkeys[9]] = 0; + keystatus[buildkeys[BK_MOVEDOWN]] = 0; } } } @@ -877,10 +877,10 @@ void editinput(void) if (goalz != posz) { - //if (posz < goalz) hvel += (32< goalz) hvel -= (32< goalz) hvel = ((synctics*-192)< goalz) hvel -= (32< goalz) hvel = ((synctics*-192)< 0) //S (insert sprite) (3D) + if (keystatus[0x1f]) //S (insert sprite) (3D) { dax = 16384; day = divscale14(searchx-(xdim>>1),xdim>>1); @@ -2541,7 +2541,7 @@ void editinput(void) keystatus[0xd3] = 0; } - if ((keystatus[0x3f]|keystatus[0x40]) > 0) //F5,F6 + if (keystatus[0x3f]||keystatus[0x40]) //F5,F6 { switch (searchstat) { @@ -2556,7 +2556,7 @@ void editinput(void) } keystatus[0x3f] = 0, keystatus[0x40] = 0; } - if ((keystatus[0x41]|keystatus[0x42]) > 0) //F7,F8 + if (keystatus[0x41]||keystatus[0x42]) //F7,F8 { switch (searchstat) { @@ -2573,11 +2573,11 @@ void editinput(void) } } - if (keystatus[buildkeys[14]] > 0) // Enter + if (keystatus[buildkeys[BK_MODE2D_3D]]) // Enter { setbrightness(0,palette,0); overheadeditor(); - keystatus[buildkeys[14]] = 0; + keystatus[buildkeys[BK_MODE2D_3D]] = 0; } } @@ -3009,8 +3009,8 @@ void overheadeditor(void) circlewall = -1; circlepoints = 7; bstatus = 0; - keystatus[buildkeys[14]] = 0; - while ((keystatus[buildkeys[14]]>>1) == 0) + keystatus[buildkeys[BK_MODE2D_3D]] = 0; + while ((keystatus[buildkeys[BK_MODE2D_3D]]>>1) == 0) { if (handleevents()) { @@ -3050,7 +3050,7 @@ void overheadeditor(void) { //ENGINE calculates angvel for you doubvel = synctics; - if (keystatus[buildkeys[4]] > 0) //Lt. shift makes turn velocity 50% faster + if (keystatus[buildkeys[BK_RUN]]) //Lt. shift makes turn velocity 50% faster doubvel += (synctics>>1); ang += ((angvel*doubvel)>>4); ang = (ang+2048)&2047; @@ -3058,7 +3058,7 @@ void overheadeditor(void) if ((vel|svel) != 0) { doubvel = synctics; - if (keystatus[buildkeys[4]] > 0) //Lt. shift doubles forward velocity + if (keystatus[buildkeys[BK_RUN]]) //Lt. shift doubles forward velocity doubvel += synctics; xvect = 0, yvect = 0; if (vel != 0) @@ -3275,7 +3275,7 @@ void overheadeditor(void) ExtCheckKeys(); // TX 20050101, it makes more sense to have this here so keys can be overwritten with new functions in bstub.c // Flip/mirror sector Ed Coolidge - if (keystatus[0x2d] > 0) // X (2D) + if (keystatus[0x2d]) // X (2D) { if (highlightsectorcnt > 0) { @@ -3395,7 +3395,7 @@ void overheadeditor(void) asksave = 1; } } - if (keystatus[0x15] > 0) // Y (2D) + if (keystatus[0x15]) // Y (2D) { if (highlightsectorcnt > 0) { @@ -3515,7 +3515,7 @@ void overheadeditor(void) } // end edit for sector flip - if (keystatus[88] > 0) //F12 + if (keystatus[88]) //F12 { keystatus[88] = 0; /* @@ -3535,7 +3535,7 @@ void overheadeditor(void) */ showframe(1); } - if (keystatus[0x30] > 0) // B (clip Blocking xor) (2D) + if (keystatus[0x30]) // B (clip Blocking xor) (2D) { pointhighlight = getpointhighlight(mousxplc, mousyplc); linehighlight = getlinehighlight(mousxplc, mousyplc); @@ -3560,10 +3560,10 @@ void overheadeditor(void) } keystatus[0x30] = 0; } - if (keystatus[0x21] > 0) //F (F alone does nothing in 2D right now) + if (keystatus[0x21]) //F (F alone does nothing in 2D right now) { keystatus[0x21] = 0; - if ((keystatus[0x38]|keystatus[0xb8]) > 0) //ALT-F (relative alignmment flip) + if (keystatus[0x38]|keystatus[0xb8]) //ALT-F (relative alignmment flip) { linehighlight = getlinehighlight(mousxplc, mousyplc); if (linehighlight >= 0) @@ -3575,7 +3575,7 @@ void overheadeditor(void) } } - if (keystatus[0x18] > 0) // O (ornament onto wall) (2D) + if (keystatus[0x18]) // O (ornament onto wall) (2D) { keystatus[0x18] = 0; if ((pointhighlight&0xc000) == 16384) @@ -3606,7 +3606,7 @@ void overheadeditor(void) } } - if (keystatus[0x33] > 0) // , (2D) + if (keystatus[0x33]) // , (2D) { if (highlightsectorcnt > 0) { @@ -3688,7 +3688,7 @@ void overheadeditor(void) if (pointhighlight >= 16384) { i = pointhighlight-16384; - if ((keystatus[0x2a]|keystatus[0x36]) > 0) + if (keystatus[0x2a]|keystatus[0x36]) sprite[i].ang = ((sprite[i].ang+2048-1)&2047); else { @@ -3701,7 +3701,7 @@ void overheadeditor(void) } } } - if (keystatus[0x34] > 0) // . (2D) + if (keystatus[0x34]) // . (2D) { if (highlightsectorcnt > 0) { @@ -3783,7 +3783,7 @@ void overheadeditor(void) if (pointhighlight >= 16384) { i = pointhighlight-16384; - if ((keystatus[0x2a]|keystatus[0x36]) > 0) + if (keystatus[0x2a]|keystatus[0x36]) sprite[i].ang = ((sprite[i].ang+2048+1)&2047); else { @@ -3796,7 +3796,7 @@ void overheadeditor(void) } } } - if (keystatus[0x46] > 0) //Scroll lock (set starting position) + if (keystatus[0x46]) //Scroll lock (set starting position) { startposx = posx; startposy = posy; @@ -3807,7 +3807,7 @@ void overheadeditor(void) asksave = 1; } - if (keystatus[0x3f] > 0) //F5 + if (keystatus[0x3f]) //F5 { keystatus[0x3f] = 0; @@ -3820,7 +3820,7 @@ void overheadeditor(void) break; } } - if (keystatus[0x40] > 0) //F6 + if (keystatus[0x40]) //F6 { keystatus[0x40] = 0; @@ -3841,7 +3841,7 @@ void overheadeditor(void) ydim16 = ydim-STATUS2DSIZ; } } - if (keystatus[0x41] > 0) //F7 + if (keystatus[0x41]) //F7 { keystatus[0x41] = 0; @@ -3854,7 +3854,7 @@ void overheadeditor(void) break; } } - if (keystatus[0x42] > 0) //F8 + if (keystatus[0x42]) //F8 { keystatus[0x42] = 0; @@ -3876,10 +3876,10 @@ void overheadeditor(void) } } - if (keystatus[0x14] > 0) // T (tag) + if (keystatus[0x14]) // T (tag) { keystatus[0x14] = 0; - if ((keystatus[0x1d]|keystatus[0x9d]) > 0) //Ctrl-T + if (keystatus[0x1d]|keystatus[0x9d]) //Ctrl-T { showtags ^= 1; if (showtags == 0) @@ -3887,7 +3887,7 @@ void overheadeditor(void) else printmessage16("Show tags ON"); } - else if ((keystatus[0x38]|keystatus[0xb8]) > 0) //ALT + else if (keystatus[0x38]|keystatus[0xb8]) //ALT { if (pointhighlight >= 16384) { @@ -3921,10 +3921,10 @@ void overheadeditor(void) printmessage16(""); } } - if (keystatus[0x23] > 0) //H (Hi 16 bits of tag) + if (keystatus[0x23]) //H (Hi 16 bits of tag) { keystatus[0x23] = 0; - if ((keystatus[0x1d]|keystatus[0x9d]) > 0) //Ctrl-H + if (keystatus[0x1d]|keystatus[0x9d]) //Ctrl-H { pointhighlight = getpointhighlight(mousxplc, mousyplc); linehighlight = getlinehighlight(mousxplc, mousyplc); @@ -3945,7 +3945,7 @@ void overheadeditor(void) asksave = 1; } } - else if ((keystatus[0x38]|keystatus[0xb8]) > 0) //ALT + else if (keystatus[0x38]|keystatus[0xb8]) //ALT { if (pointhighlight >= 16384) { @@ -3978,7 +3978,7 @@ void overheadeditor(void) } printmessage16(""); } - if (keystatus[0x19] > 0) // P (palookup #) + if (keystatus[0x19]) // P (palookup #) { keystatus[0x19] = 0; @@ -3999,7 +3999,7 @@ void overheadeditor(void) break; } } - if (keystatus[0x12] > 0) // E (status list) + if (keystatus[0x12]) // E (status list) { if (pointhighlight >= 16384) { @@ -4015,7 +4015,7 @@ void overheadeditor(void) keystatus[0x12] = 0; } - if (keystatus[0x0f] > 0) //TAB + if (keystatus[0x0f]) //TAB { clearmidstatbar16(); @@ -4041,7 +4041,7 @@ void overheadeditor(void) if (highlightsectorcnt < 0) { - if (keystatus[0x36] > 0) //Right shift (point highlighting) + if (keystatus[0x36]) //Right shift (point highlighting) { if (highlightcnt == 0) { @@ -4081,7 +4081,7 @@ void overheadeditor(void) tempint = highlighty1; highlighty1 = highlighty2; highlighty2 = tempint; } - if ((keystatus[0x1d]|keystatus[0x9d]) > 0) + if (keystatus[0x1d]|keystatus[0x9d]) { if ((linehighlight >= 0) && (linehighlight < MAXWALLS)) { @@ -4131,7 +4131,7 @@ void overheadeditor(void) } if (highlightcnt < 0) { - if (keystatus[0xb8] > 0) //Right alt (sector highlighting) + if (keystatus[0xb8]) //Right alt (sector highlighting) { if (highlightsectorcnt == 0) { @@ -4462,7 +4462,7 @@ void overheadeditor(void) posy = mousyplc; } - if (((keystatus[buildkeys[8]] > 0) || (bstatus&16)) && (zoom < 16384)) + if ((keystatus[buildkeys[BK_MOVEUP]] || (bstatus&16)) && (zoom < 16384)) { zoom += synctics*(zoom>>4); if (zoom < 24) zoom += 2; @@ -4474,7 +4474,7 @@ void overheadeditor(void) posy = mousyplc; } } - if (((keystatus[buildkeys[9]] > 0) || (bstatus&32)) && (zoom > 8)) + if ((keystatus[buildkeys[BK_MOVEDOWN]] || (bstatus&32)) && (zoom > 8)) { zoom -= synctics*(zoom>>4); if (bstatus&32 && (keystatus[0x38] || keystatus[0xb8])) @@ -4488,13 +4488,13 @@ void overheadeditor(void) if (zoom < 8) zoom = 8; if (zoom > 16384) zoom = 16384; - if (keystatus[0x22] > 0) // G (grid on/off) + if (keystatus[0x22]) // G (grid on/off) { grid++; if (grid == 7) grid = 0; keystatus[0x22] = 0; } - if (keystatus[0x26] > 0) // L (grid lock) + if (keystatus[0x26]) // L (grid lock) { gridlock = 1-gridlock, keystatus[0x26] = 0; if (gridlock == 0) @@ -4503,7 +4503,7 @@ void overheadeditor(void) printmessage16("Grid locking ON"); } - if (keystatus[0x24] > 0) // J (join sectors) + if (keystatus[0x24]) // J (join sectors) { if (joinsector[0] >= 0) { @@ -4620,7 +4620,7 @@ void overheadeditor(void) keystatus[0x24] = 0; } - if (((keystatus[0x38]|keystatus[0xb8])&keystatus[0x1f]) > 0) //ALT-S + if ((keystatus[0x38]||keystatus[0xb8])&&keystatus[0x1f]) //ALT-S { if ((linehighlight >= 0) && (wall[linehighlight].nextwall == -1)) { @@ -4643,7 +4643,7 @@ void overheadeditor(void) } keystatus[0x1f] = 0; } - else if (keystatus[0x1f] > 0) //S + else if (keystatus[0x1f]) //S { sucksect = -1; for (i=0;i 0) // C (make circle of points) + if (keystatus[0x2e]) // C (make circle of points) { if (highlightsectorcnt >= 0) { @@ -4793,20 +4793,20 @@ void overheadeditor(void) } keystatus[0x2e] = 0; } - if (keystatus[0x4a] > 0) // - + if (keystatus[0x4a]) // - { if (circlepoints > 1) circlepoints--; keystatus[0x4a] = 0; } - if (keystatus[0x4e] > 0) // + + if (keystatus[0x4e]) // + { if (circlepoints < 63) circlepoints++; keystatus[0x4e] = 0; } - bad = (keystatus[0x39] > 0); //Gotta do this to save lots of 3 spaces! + bad = (keystatus[0x39]); //Gotta do this to save lots of 3 spaces! if (circlewall >= 0) { @@ -5446,7 +5446,7 @@ void overheadeditor(void) } } - if (keystatus[0x1c] > 0) //Left Enter + if (keystatus[0x1c]) //Left Enter { keystatus[0x1c] = 0; if (keystatus[0x2a]&keystatus[0x1d]) @@ -5489,7 +5489,7 @@ void overheadeditor(void) } } - if ((keystatus[0x0e] > 0) && (newnumwalls >= numwalls)) //Backspace + if (keystatus[0x0e] && (newnumwalls >= numwalls)) //Backspace { if (newnumwalls > numwalls) { @@ -5505,7 +5505,7 @@ void overheadeditor(void) } } - if ((keystatus[0xd3] > 0) && ((keystatus[0x1d]|keystatus[0x9d]) > 0) && (numwalls >= 0)) + if (keystatus[0xd3] && (keystatus[0x1d]||keystatus[0x9d]) && (numwalls >= 0)) { //sector delete keystatus[0xd3] = 0; @@ -5544,7 +5544,7 @@ void overheadeditor(void) } } - if ((keystatus[0xd3] > 0) && (pointhighlight >= 0)) + if (keystatus[0xd3] && (pointhighlight >= 0)) { if ((pointhighlight&0xc000) == 16384) //Sprite Delete { @@ -5556,7 +5556,7 @@ void overheadeditor(void) keystatus[0xd3] = 0; } - if (keystatus[0xd2] > 0) //InsertPoint + if (keystatus[0xd2]) //InsertPoint { if (highlightsectorcnt >= 0) { @@ -5667,11 +5667,11 @@ void overheadeditor(void) synctics = totalclock-lockclock; lockclock += synctics; - if (keystatus[buildkeys[14]] > 0) + if (keystatus[buildkeys[BK_MODE2D_3D]]) { updatesector(posx,posy,&cursectnum); if (cursectnum >= 0) - keystatus[buildkeys[14]] = 2; + keystatus[buildkeys[BK_MODE2D_3D]] = 2; else printmessage16("Arrow must be inside a sector before entering 3D mode."); } @@ -5738,8 +5738,8 @@ void overheadeditor(void) // ^^^ PK ------------------------------------ CANCEL: - if (keystatus[1] > 0 && joinsector[0] >= 0) {keystatus[1]=0;joinsector[0]=-1;} - if (keystatus[1] > 0) + if (keystatus[1] && joinsector[0] >= 0) {keystatus[1]=0;joinsector[0]=-1;} + if (keystatus[1]) { keystatus[1] = 0; printmessage16("(N)ew, (L)oad, (S)ave, save (A)s, (Q)uit"); @@ -5759,7 +5759,7 @@ CANCEL: ch = bgetchar(); - if (keystatus[1] > 0) + if (keystatus[1]) { keystatus[1] = 0; bad = 0; @@ -6014,7 +6014,7 @@ CANCEL: ch = bgetchar(); - if (keystatus[1] > 0) bad = 1; + if (keystatus[1]) bad = 1; else if (ch == 13) bad = 2; else if (ch > 0) { @@ -6975,7 +6975,7 @@ int menuselect(void) { // JBF 20040208: seek to first name matching pressed character CACHE1D_FIND_REC *seeker = currentlist ? findfiles : finddirs; - if ((keystatus[0xc7]|keystatus[0xcf]) > 0) // home/end + if (keystatus[0xc7]||keystatus[0xcf]) // home/end { while (keystatus[0xcf]?seeker->next:seeker->prev) seeker = keystatus[0xcf]?seeker->next:seeker->prev; @@ -6987,7 +6987,7 @@ int menuselect(void) ch = keystatus[0xcf]?80:72; keystatus[0xc7] = keystatus[0xcf] = 0; } - else if ((keystatus[0xc9]|keystatus[0xd1]) > 0) // page up/down + else if (keystatus[0xc9]|keystatus[0xd1]) // page up/down { seeker = currentlist?findfileshigh:finddirshigh; i = (ydim2d-STATUS2DSIZ-48)>>5/*3*/; //PK @@ -7028,10 +7028,10 @@ int menuselect(void) } } } - if (keystatus[0xcb] > 0) ch = 9; // left arr - if (keystatus[0xcd] > 0) ch = 9; // right arr - if (keystatus[0xc8] > 0) ch = 72; // up arr - if (keystatus[0xd0] > 0) ch = 80; // down arr + if (keystatus[0xcb]) ch = 9; // left arr + if (keystatus[0xcd]) ch = 9; // right arr + if (keystatus[0xc8]) ch = 72; // up arr + if (keystatus[0xd0]) ch = 80; // down arr } if (ch == 'f' || ch == 'F') { @@ -7688,21 +7688,21 @@ void keytimerstuff(void) if (totalclock == ltotalclock) return; ltotalclock=totalclock; - if (keystatus[buildkeys[5]] == 0) + if (keystatus[buildkeys[BK_STRAFE]] == 0) { // PK: With GCC and Polymost, keyboard turning lags - if (keystatus[buildkeys[2]] > 0) angvel = max(angvel-pk_turnaccel /* 16 */,-128); - if (keystatus[buildkeys[3]] > 0) angvel = min(angvel+pk_turnaccel /* 16 */,127); + if (keystatus[buildkeys[BK_TURNLEFT]]) angvel = max(angvel-pk_turnaccel /* 16 */,-128); + if (keystatus[buildkeys[BK_TURNRIGHT]]) angvel = min(angvel+pk_turnaccel /* 16 */,127); } else { - if (keystatus[buildkeys[2]] > 0) svel = min(svel+16,255); // svel and vel aren't even chars... - if (keystatus[buildkeys[3]] > 0) svel = max(svel-16,-256); + if (keystatus[buildkeys[BK_TURNLEFT]]) svel = min(svel+16,255); // svel and vel aren't even chars... + if (keystatus[buildkeys[BK_TURNRIGHT]]) svel = max(svel-16,-256); } - if (keystatus[buildkeys[0]] > 0) vel = min(vel+16,255); - if (keystatus[buildkeys[1]] > 0) vel = max(vel-16,-256); - /* if (keystatus[buildkeys[12]] > 0) svel = min(svel+8,127); - if (keystatus[buildkeys[13]] > 0) svel = max(svel-8,-128); */ + if (keystatus[buildkeys[BK_MOVEFORWARD]]) vel = min(vel+16,255); + if (keystatus[buildkeys[BK_MOVEBACKWARD]]) vel = max(vel-16,-256); + /* if (keystatus[buildkeys[BK_STRAFELEFT]]) svel = min(svel+8,127); + if (keystatus[buildkeys[BK_STRAFERIGHT]]) svel = max(svel-8,-128); */ if (angvel < 0) angvel = min(angvel+pk_turndecel /*12*/,0); if (angvel > 0) angvel = max(angvel-pk_turndecel /*12*/,0); diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 466cb31a0..0605bfe9b 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -61,6 +61,11 @@ static struct strllist *CommandPaths = NULL, *CommandGrps = NULL; #define MAXHELP2D (signed int)(sizeof(Help2d)/sizeof(Help2d[0])) + +#define eitherALT (keystatus[KEYSC_LALT]| keystatus[KEYSC_RALT]) +#define eitherCTRL (keystatus[KEYSC_LCTRL]| keystatus[KEYSC_RCTRL]) +#define eitherSHIFT (keystatus[KEYSC_LSHIFT]|keystatus[KEYSC_RSHIFT]) + static char *Help2d[]= { " 'A = Autosave toggle", @@ -151,6 +156,7 @@ static char *Help3d[]= " HOME = PGUP/PGDN MODIFIER (256 UNITS)", " END = PGUP/PGDN MODIFIER (512 UNITS)", }; +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; @@ -1435,9 +1441,9 @@ void ExtEditSectorData(short sectnum) //F7 // if (qsetmode != 200) Show2dText("sthelp.hlp"); if (qsetmode == 200) return; - if ((keystatus[0x38]|keystatus[0xb8]) > 0) //ALT + if (eitherALT) //ALT { - keystatus[67] = 0; + keystatus[KEYSC_F7] = 0; wallsprite=0; curwall = 0; curwallnum = 0; @@ -1455,7 +1461,7 @@ void ExtEditWallData(short wallnum) //F8 { if (qsetmode==200) return; - if ((keystatus[0x38]|keystatus[0xb8]) > 0) //ALT + if (eitherALT) //ALT { wallsprite=1; curwall = wallnum; @@ -1478,7 +1484,7 @@ void ExtEditSpriteData(short spritenum) //F8 { if (qsetmode==200) return; - if ((keystatus[0x38]|keystatus[0xb8]) > 0) //ALT + if (eitherALT) //ALT { wallsprite=2; cursearchsprite = spritenum; @@ -1662,7 +1668,7 @@ static int AskIfSure(void) showframe(1); - while ((keystatus[1]|keystatus[0x1c]|keystatus[0x39]|keystatus[0x31]) == 0) + while ((keystatus[KEYSC_ESC]|keystatus[KEYSC_ENTER]|keystatus[KEYSC_SPACE]|keystatus[KEYSC_N]) == 0) { if (handleevents()) { @@ -1673,16 +1679,16 @@ static int AskIfSure(void) } } idle(); - if (keystatus[0x15] != 0) + if (keystatus[KEYSC_Y]) { - keystatus[0x15] = 0; + keystatus[KEYSC_Y] = 0; retval = 0; break; } } - while (keystatus[1]) + while (keystatus[KEYSC_ESC]) { - keystatus[1] = 0; + keystatus[KEYSC_ESC] = 0; retval = 1; break; } @@ -1772,7 +1778,7 @@ static int m32gettile(int idInitialTile) } while (!nDisplayedTiles); - keystatus[0x2F] = 0; + keystatus[KEYSC_V] = 0; for (i = 0; i < MAXTILES; i++) { @@ -1912,7 +1918,7 @@ static int m32gettile(int idInitialTile) // Start of key handling code // //////////////////////////////// - while ((keystatus[0x1c]|keystatus[1]) == 0) // <- Presumably one of these is escape key ??? + while ((keystatus[KEYSC_ENTER]|keystatus[KEYSC_ESC]) == 0) // <- Presumably one of these is escape key ??? { DrawTiles(iTopLeftTile, iTile, nXTiles, nYTiles, ZoomToThumbSize[s_Zoom]); @@ -1927,12 +1933,12 @@ static int m32gettile(int idInitialTile) lockclock += synctics; // Zoom in / out using numeric key pad's / and * keys - if (((keystatus[0xb5] > 0) && ((unsigned)s_Zoom < NUM_ZOOMS-1)) - || ((keystatus[0x37] > 0) && (s_Zoom > 0))) + if (((keystatus[KEYSC_gSLASH] && (unsigned)s_Zoom<(NUM_ZOOMS-1)) + || ((keystatus[KEYSC_gSTAR]) && s_Zoom>0))) { - if (keystatus[0xb5]) + if (keystatus[KEYSC_gSLASH]) { - keystatus[0xb5] = 0; + keystatus[KEYSC_gSLASH] = 0; // Watch out : If editor window is small, then the next zoom level // might get so large that even one tile might not fit ! @@ -1945,7 +1951,7 @@ static int m32gettile(int idInitialTile) } else { - keystatus[0x37] = 0; + keystatus[KEYSC_gSTAR] = 0; s_Zoom--; } @@ -1969,46 +1975,40 @@ static int m32gettile(int idInitialTile) } - // LEFT KEYPRESS - if (keystatus[0xcb] > 0) + if (keystatus[KEYSC_LEFT]) { iTile -= (iTile > 0); - keystatus[0xcb] = 0; + keystatus[KEYSC_LEFT] = 0; } - // RIGHT KEYPRESS - if (keystatus[0xcd] > 0) + if (keystatus[KEYSC_RIGHT]) { iTile += (iTile < MAXTILES); - keystatus[0xcd] = 0; + keystatus[KEYSC_RIGHT] = 0; } - // UP KEYPRESS - if (keystatus[0xc8] > 0) + if (keystatus[KEYSC_UP]) { iTile -= nXTiles; - keystatus[0xc8] = 0; + keystatus[KEYSC_UP] = 0; } - // DOWN KEYPRESS - if (keystatus[0xd0] > 0) + if (keystatus[KEYSC_DOWN]) { iTile += nXTiles; - keystatus[0xd0] = 0; + keystatus[KEYSC_DOWN] = 0; } - // PGUP KEYPRESS - if (keystatus[0xc9] > 0) + if (keystatus[KEYSC_PGUP]) { iTile -= nDisplayedTiles; - keystatus[0xc9] = 0; + keystatus[KEYSC_PGUP] = 0; } - // PGDOWN KEYPRESS - if (keystatus[0xd1] > 0) + if (keystatus[KEYSC_PGDN]) { iTile += nDisplayedTiles; - keystatus[0xd1] = 0; + keystatus[KEYSC_PGDN] = 0; } // @@ -2026,7 +2026,7 @@ static int m32gettile(int idInitialTile) } // 'V' KEYPRESS - if (keystatus[KEYSC_V] > 0) + if (keystatus[KEYSC_V]) { keystatus[KEYSC_V] = 0; @@ -2034,7 +2034,7 @@ static int m32gettile(int idInitialTile) } // 'G' KEYPRESS - Goto frame - if (keystatus[KEYSC_G] > 0) + if (keystatus[KEYSC_G]) { keystatus[KEYSC_G] = 0; @@ -2109,7 +2109,7 @@ static int m32gettile(int idInitialTile) iTopLeftTile = MAXTILES - nDisplayedTiles; } - if (keystatus[0x1c] == 0) // uh ? Not escape key ? + if ((keystatus[KEYSC_ENTER]) == 0) // uh ? Not escape key ? { idSelectedTile = idInitialTile; } @@ -2133,8 +2133,8 @@ static int m32gettile(int idInitialTile) } } - keystatus[0x1] = 0; - keystatus[0x1c] = 0; + keystatus[KEYSC_ESC] = 0; + keystatus[KEYSC_ENTER] = 0; return(idSelectedTile); @@ -2158,7 +2158,7 @@ static int OnGotoTile(int iTile) iNewTile = iTemp = 0; //iTile; //PK - while (keystatus[1] == 0) + while (keystatus[KEYSC_ESC] == 0) { if (handleevents()) { @@ -2264,7 +2264,7 @@ static int OnSelectTile(int iTile) bDone = 0; - while (keystatus[1] == 0 && (!bDone)) + while (keystatus[KEYSC_ESC] == 0 && (!bDone)) { if (handleevents()) { @@ -2437,6 +2437,23 @@ static int DrawTiles(int iTopLeft, int iSelected, int nXTiles, int nYTiles, int extern char unrealedlook; //PK +int spriteonceilingz(int searchwall) +{ + int z=sprite[searchwall].z; + z = getceilzofslope(searchsector,sprite[searchwall].x,sprite[searchwall].y); + if (sprite[searchwall].cstat&128) z -= ((tilesizy[sprite[searchwall].picnum]*sprite[searchwall].yrepeat)<<1); + if ((sprite[searchwall].cstat&48) != 32) + z += ((tilesizy[sprite[searchwall].picnum]*sprite[searchwall].yrepeat)<<2); + return z; +} + +int spriteongroundz(int searchwall) +{ + int z=sprite[searchwall].z; + z = getflorzofslope(searchsector,sprite[searchwall].x,sprite[searchwall].y); + if (sprite[searchwall].cstat&128) z -= ((tilesizy[sprite[searchwall].picnum]*sprite[searchwall].yrepeat)<<1); + return z; +} static void Keys3d(void) { int i,count,rate,nexti; @@ -2562,9 +2579,9 @@ static void Keys3d(void) } } - if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x2f]==1) // ' V + if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_V]) // ' V { - keystatus[0x2f] = 0; + keystatus[KEYSC_V] = 0; switch (searchstat) { case 1: @@ -2599,7 +2616,7 @@ static void Keys3d(void) message("Visibility changed on all selected sectors"); } - if (keystatus[KEYSC_V] > 0) //V + if (keystatus[KEYSC_V]) //V { if (searchstat == 0) tempint = wall[searchwall].picnum; if (searchstat == 1) tempint = sector[searchsector].ceilingpicnum; @@ -2618,20 +2635,22 @@ static void Keys3d(void) wall[wall[searchwall].nextwall].overpicnum = tempint; } asksave = 1; - keystatus[0x2f] = 0; + keystatus[KEYSC_V] = 0; } - if (keystatus[0x04] > 0) /* 3 (toggle floor-over-floor (cduke3d only) */ + if (keystatus[KEYSC_3]) /* 3 (toggle floor-over-floor (cduke3d only) */ { floor_over_floor = !floor_over_floor; // if (!floor_over_floor) ResetFOFSize(); - keystatus[0x04] = 0; + Bsprintf(tempbuf,"Floor-over-floor %s",floor_over_floor?"ON":"OFF"); + message(tempbuf); + keystatus[KEYSC_3] = 0; } if (keystatus[KEYSC_F3]) { mlook = 1-mlook; - Bsprintf(tempbuf,"Mouselook: %d",mlook); + Bsprintf(tempbuf,"Mouselook %s",mlook?"ON":"OFF"); message(tempbuf); keystatus[KEYSC_F3] = 0; } @@ -2645,18 +2664,22 @@ static void Keys3d(void) keystatus[KEYSC_F5] = 0; } - if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x0e]==1) // ' del + if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_BS]) // ' del { - keystatus[0x0e] = 0; + keystatus[KEYSC_BS] = 0; switch (searchstat) { case 0: case 4: wall[searchwall].cstat = 0; + Bsprintf(tempbuf,"Wall %d cstat = 0",searchwall); + message(tempbuf); break; // case 1: case 2: sector[searchsector].cstat = 0; break; case 3: sprite[searchwall].cstat = 0; + Bsprintf(tempbuf,"Sprite %d cstat = 0",searchwall); + message(tempbuf); break; } } @@ -2755,7 +2778,7 @@ static void Keys3d(void) message("Palettes changed"); } - if (keystatus[0xd3] > 0) + if (keystatus[KEYSC_DELETE]) { if (searchstat == 3) { @@ -2765,21 +2788,21 @@ static void Keys3d(void) message(tempbuf); asksave = 1; } - keystatus[0xd3] = 0; + keystatus[KEYSC_DELETE] = 0; } - if (keystatus[KEYSC_F6] > 0) //F6 + if (keystatus[KEYSC_F6]) //F6 { keystatus[KEYSC_F6] = 0; autospritehelp=!autospritehelp; - Bsprintf(tempbuf,"Automatic SECTOREFFECTOR help: %d",autospritehelp); + Bsprintf(tempbuf,"Automatic SECTOREFFECTOR help %s",autospritehelp?"ON":"OFF"); message(tempbuf); } - if (keystatus[KEYSC_F7] > 0) //F7 + if (keystatus[KEYSC_F7]) //F7 { keystatus[KEYSC_F7] = 0; autosecthelp=!autosecthelp; - Bsprintf(tempbuf,"Automatic sector tag help: %d",autosecthelp); + Bsprintf(tempbuf,"Automatic sector tag help %s",autosecthelp?"ON":"OFF"); message(tempbuf); } @@ -2792,45 +2815,47 @@ static void Keys3d(void) - if (keystatus[0x33] > 0) // , Search & fix panning to the left (3D) + if (keystatus[KEYSC_COMMA]) // , Search & fix panning to the left (3D) { if (searchstat == 3) { i = searchwall; - if ((keystatus[0x2a]|keystatus[0x36]) > 0) + if (eitherSHIFT) sprite[i].ang = ((sprite[i].ang+2048-1)&2047); else { sprite[i].ang = ((sprite[i].ang+2048-128)&2047); - keystatus[0x33] = 0; + keystatus[KEYSC_COMMA] = 0; } Bsprintf(tempbuf,"Sprite %d angle: %d",i,sprite[i].ang); message(tempbuf); } } - if (keystatus[0x34] > 0) // . Search & fix panning to the right (3D) + if (keystatus[KEYSC_PERIOD]) // . Search & fix panning to the right (3D) { if ((searchstat == 0) || (searchstat == 4)) { AutoAlignWalls((int)searchwall,0L); - keystatus[0x34] = 0; + Bsprintf(tempbuf,"Wall %d autoalign",searchwall); + message(tempbuf); + keystatus[KEYSC_PERIOD] = 0; } if (searchstat == 3) { i = searchwall; - if ((keystatus[0x2a]|keystatus[0x36]) > 0) + if (eitherSHIFT) sprite[i].ang = ((sprite[i].ang+2048+1)&2047); else { sprite[i].ang = ((sprite[i].ang+2048+128)&2047); - keystatus[0x34] = 0; + keystatus[KEYSC_PERIOD] = 0; } Bsprintf(tempbuf,"Sprite %d angle: %d",i,sprite[i].ang); message(tempbuf); } } - if ((keystatus[KEYSC_L] > 0) && (keystatus[KEYSC_QUOTE] > 0)) // ' L + if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_L]) // ' L { switch (searchstat) { @@ -2877,18 +2902,21 @@ static void Keys3d(void) getzrange(posx,posy,posz,cursectnum,&hiz,&hihit,&loz,&lohit,128L,CLIPMASK0); - if (keystatus[KEYSC_CAPS] > 0 || ((keystatus[KEYSC_Z] > 0) && (keystatus[KEYSC_QUOTE] > 0))) + if (keystatus[KEYSC_CAPS] || (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_Z])) { zmode++; if (zmode == 3) zmode = 0; else if (zmode == 1) zlock = (loz-posz)&0xfffffc00; - if (zmode == 0) message("Zmode = Gravity"); - else if (zmode == 1) message("Zmode = Locked/Sector"); - else if (zmode == 2) message("Zmode = Locked/Free"); + switch (zmode) + { + case 0: message("Zmode = Gravity");break; + case 1: message("Zmode = Locked/Sector");break; + case 2: message("Zmode = Locked/Free");break; + } keystatus[KEYSC_CAPS] = keystatus[KEYSC_Z] = 0; } - if (keystatus[KEYSC_M] > 0 && (keystatus[KEYSC_QUOTE]) > 0) // M + if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_M]) // M { switch (searchstat) { @@ -2914,12 +2942,12 @@ static void Keys3d(void) keystatus[KEYSC_M] = 0; } - if (keystatus[KEYSC_1] > 0) // 1 (make 1-way wall) + if (keystatus[KEYSC_1]) // 1 (make 1-way wall) { if (searchstat != 3) { wall[searchwall].cstat ^= 32; - sprintf(getmessage,"Wall %d 1 side masking %s",searchwall,wall[searchwall].cstat&32?"ON":"OFF"); + sprintf(getmessage,"Wall %d one side masking %s",searchwall,wall[searchwall].cstat&32?"ON":"OFF"); message(getmessage); asksave = 1; } @@ -2935,13 +2963,13 @@ static void Keys3d(void) sprite[searchwall].cstat |= 8; } asksave = 1; - sprintf(getmessage,"Sprite %d 1 sided %s",searchwall,sprite[searchwall].cstat&64?"ON":"OFF"); + sprintf(getmessage,"Sprite %d one sided %s",searchwall,sprite[searchwall].cstat&64?"ON":"OFF"); message(getmessage); } keystatus[KEYSC_1] = 0; } - if (keystatus[KEYSC_2] > 0) // 2 (bottom wall swapping) + if (keystatus[KEYSC_2]) // 2 (bottom wall swapping) { if (searchstat != 3) { @@ -2952,11 +2980,13 @@ static void Keys3d(void) } keystatus[KEYSC_2] = 0; } - if (keystatus[KEYSC_O] > 0) // O (top/bottom orientation - for doors) + if (keystatus[KEYSC_O]) // O (top/bottom orientation - for doors) { if ((searchstat == 0) || (searchstat == 4)) { wall[searchwall].cstat ^= 4; + Bsprintf(getmessage,"Wall %d %s orientation",searchwall,wall[searchwall].cstat&4?"bottom":"top"); + message(getmessage); asksave = 1; } if (searchstat == 3) // O (ornament onto wall) (2D) @@ -2984,15 +3014,17 @@ static void Keys3d(void) sprite[i].x -= ksgn(wall[j].y-wall[hitwall].y); sprite[i].y += ksgn(wall[j].x-wall[hitwall].x); } + Bsprintf(getmessage,"Sprite %d ornament onto wall",i); + message(getmessage); } keystatus[KEYSC_O] = 0; } - if (keystatus[KEYSC_M] > 0) // M (masking walls) + if (keystatus[KEYSC_M]) // M (masking walls) { if (searchstat != 3) { i = wall[searchwall].nextwall; - tempint = (keystatus[0x2a]|keystatus[0x36]); + tempint = eitherSHIFT; if (i >= 0) { wall[searchwall].cstat ^= 16; @@ -3025,9 +3057,9 @@ static void Keys3d(void) keystatus[KEYSC_M] = 0; } - if (keystatus[KEYSC_H] > 0) // H (hitscan sensitivity) + if (keystatus[KEYSC_H]) // H (hitscan sensitivity) { - if ((keystatus[KEYSC_QUOTE]) > 0) + if ((keystatus[KEYSC_QUOTE])) { switch (searchstat) { @@ -3065,7 +3097,7 @@ static void Keys3d(void) { wall[searchwall].cstat ^= 64; - if ((wall[searchwall].nextwall >= 0) && ((keystatus[0x2a]|keystatus[0x36]) == 0)) + if ((wall[searchwall].nextwall >= 0) && (eitherSHIFT == 0)) { wall[wall[searchwall].nextwall].cstat &= ~64; wall[wall[searchwall].nextwall].cstat |= (wall[searchwall].cstat&64); @@ -3079,8 +3111,8 @@ static void Keys3d(void) keystatus[KEYSC_H] = 0; } - smooshyalign = keystatus[0x4c]; - repeatpanalign = (keystatus[0x2a]|keystatus[0x36]|(bstatus&2)); + smooshyalign = keystatus[KEYSC_gKP5]; + repeatpanalign = eitherSHIFT || (bstatus&2); if (mlook == 2) mlook = 0; @@ -3088,27 +3120,28 @@ static void Keys3d(void) if (!unrealedlook && (bstatus&4)) mlook = 2; // if (bstatus&4) - if (bstatus&(16|32) && !(bstatus&(1|2|4))) // PK: no btn: wheel changes shade + if ((bstatus&(16|32) && !(bstatus&(1|2|4))) || keystatus[KEYSC_gMINUS] || keystatus[KEYSC_gPLUS]) // PK: no btn: wheel changes shade { // if (bstatus&1) // { // mlook = 2; // } - if (bstatus&32) // - + if (bstatus&32 || keystatus[KEYSC_gMINUS]) // - { + keystatus[KEYSC_gMINUS]=0; mouseb &= ~32; bstatus &= ~32; - if ((keystatus[0x38]|keystatus[0xb8]) > 0) //ALT + if (eitherALT) //ALT { - if ((keystatus[0x1d]|keystatus[0x9d]) > 0) //CTRL + if (eitherCTRL) //CTRL { if (visibility < 16384) visibility += visibility; + Bsprintf(getmessage,"Global visibility %d",visibility); + message(getmessage); } else { - if ((keystatus[0x2a]|keystatus[0x36]) == 0) //not SHIFT - k = 16; - else k = 1; + k=eitherSHIFT?1:16; if (highlightsectorcnt >= 0) for (i=0;i 0) //ALT + if (eitherALT) //ALT { - if ((keystatus[0x1d]|keystatus[0x9d]) > 0) //CTRL + if (eitherCTRL) //CTRL { if (visibility > 32) visibility >>= 1; + Bsprintf(getmessage,"Global visibility %d",visibility); + message(getmessage); } else { - if ((keystatus[0x2a]|keystatus[0x36]) == 0) - k = 16; - else k = 1; + k=eitherSHIFT?1:16; if (highlightsectorcnt >= 0) for (i=0;i 0) // E (expand) + if (keystatus[KEYSC_E]) // E (expand) { if (searchstat == 1) { @@ -3348,10 +3398,10 @@ static void Keys3d(void) } keystatus[KEYSC_E] = 0; } - if (keystatus[KEYSC_R] > 0) // R (relative alignment, rotation) + if (keystatus[KEYSC_R]) // R (relative alignment, rotation) { - if (keystatus[KEYSC_QUOTE] > 0) // FRAMERATE TOGGLE + if (keystatus[KEYSC_QUOTE]) // FRAMERATE TOGGLE { framerateon = !framerateon; @@ -3397,14 +3447,16 @@ static void Keys3d(void) } keystatus[KEYSC_R] = 0; } - if (keystatus[KEYSC_F] > 0) //F (Flip) + if (keystatus[KEYSC_F]) //F (Flip) { keystatus[KEYSC_F] = 0; - if ((keystatus[0x38]|keystatus[0xb8]) > 0) //ALT-F (relative alignmment flip) + if (eitherALT) //ALT-F (relative alignmment flip) { if (searchstat != 3) { setfirstwall(searchsector,searchwall); + Bsprintf(getmessage,"Sector %d first wall",searchsector); + message(getmessage); asksave = 1; } } @@ -3429,6 +3481,8 @@ static void Keys3d(void) i = 2; break; } + Bsprintf(getmessage,"Wall %d flip %d",searchwall,i); + message(getmessage); i = ((i&1)<<3)+((i&2)<<7); wall[searchwall].cstat &= ~0x0108; wall[searchwall].cstat |= i; @@ -3465,6 +3519,8 @@ static void Keys3d(void) i = 0; break; } + Bsprintf(getmessage,"Sector %d flip %d",searchsector,i); + message(getmessage); i = (i&0x4)+((i&3)<<4); sector[searchsector].ceilingstat &= ~0x34; sector[searchsector].ceilingstat |= i; @@ -3501,6 +3557,8 @@ static void Keys3d(void) i = 0; break; } + Bsprintf(getmessage,"Sector %d flip %d",searchsector,i); + message(getmessage); i = (i&0x4)+((i&3)<<4); sector[searchsector].floorstat &= ~0x34; sector[searchsector].floorstat |= i; @@ -3513,6 +3571,8 @@ static void Keys3d(void) { sprite[searchwall].cstat &= ~0xc; sprite[searchwall].cstat |= ((i&4)^4); + Bsprintf(getmessage,"Sprite %d flip %s",searchwall,sprite[searchwall].cstat&4?"ON":"OFF"); + message(getmessage); } else { @@ -3532,6 +3592,8 @@ static void Keys3d(void) i = 2; break; } + Bsprintf(getmessage,"Sprite %d flip %d",searchwall,i); + message(getmessage); i <<= 2; sprite[searchwall].cstat &= ~0xc; sprite[searchwall].cstat |= i; @@ -3541,9 +3603,9 @@ static void Keys3d(void) } } - if (keystatus[0xc7] > 0) // HOME + if (keystatus[KEYSC_HOME]) updownunits = 256; - else if (keystatus[0xcf] > 0) // END + else if (keystatus[KEYSC_END]) updownunits = 512; else updownunits = 1024; @@ -3573,10 +3635,10 @@ static void Keys3d(void) tempint += ((tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<2); if (sprite[i].cstat&128) tempint += ((tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<1); if (sprite[i].z == tempint) - sprite[i].z -= updownunits << ((keystatus[0x1d]|keystatus[0x9d])<<1); // JBF 20031128 + sprite[i].z -= updownunits << (eitherCTRL<<1); // JBF 20031128 i = nextspritesect[i]; } - sector[searchsector].ceilingz -= updownunits << ((keystatus[0x1d]|keystatus[0x9d])<<1); // JBF 20031128 + sector[searchsector].ceilingz -= updownunits << (eitherCTRL<<1); // JBF 20031128 sprintf(getmessage,"Sector %d ceilingz = %d",searchsector,sector[searchsector].ceilingz); message(getmessage); @@ -3592,10 +3654,10 @@ static void Keys3d(void) tempint += ((tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<2); if (sprite[i].cstat&128) tempint += ((tilesizy[sprite[i].picnum]*sprite[i].yrepeat)<<1); if (sprite[i].z == tempint) - sprite[i].z -= updownunits << ((keystatus[0x1d]|keystatus[0x9d])<<1); // JBF 20031128 + sprite[i].z -= updownunits << (eitherCTRL<<1); // JBF 20031128 i = nextspritesect[i]; } - sector[highlightsector[j]].ceilingz -= updownunits << ((keystatus[0x1d]|keystatus[0x9d])<<1); // JBF 20031128 + sector[highlightsector[j]].ceilingz -= updownunits << (eitherCTRL<<1); // JBF 20031128 sprintf(getmessage,"Sector %d ceilingz = %d",*highlightsector,sector[highlightsector[j]].ceilingz); message(getmessage); @@ -3612,10 +3674,10 @@ static void Keys3d(void) 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 -= updownunits << ((keystatus[0x1d]|keystatus[0x9d])<<1); // JBF 20031128 + sprite[i].z -= updownunits << (eitherCTRL<<1); // JBF 20031128 i = nextspritesect[i]; } - sector[searchsector].floorz -= updownunits << ((keystatus[0x1d]|keystatus[0x9d])<<1); // JBF 20031128 + sector[searchsector].floorz -= updownunits << (eitherCTRL<<1); // JBF 20031128 sprintf(getmessage,"Sector %d floorz = %d",searchsector,sector[searchsector].floorz); message(getmessage); @@ -3630,10 +3692,10 @@ static void Keys3d(void) tempint = getflorzofslope(highlightsector[j],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 -= updownunits << ((keystatus[0x1d]|keystatus[0x9d])<<1); // JBF 20031128 + sprite[i].z -= updownunits << (eitherCTRL<<1); // JBF 20031128 i = nextspritesect[i]; } - sector[highlightsector[j]].floorz -= updownunits << ((keystatus[0x1d]|keystatus[0x9d])<<1); // JBF 20031128 + sector[highlightsector[j]].floorz -= updownunits << (eitherCTRL<<1); // JBF 20031128 sprintf(getmessage,"Sector %d floorz = %d",*highlightsector,sector[highlightsector[j]].floorz); message(getmessage); @@ -3645,12 +3707,9 @@ static void Keys3d(void) sector[searchsector].floorz = sector[searchsector].ceilingz; if (searchstat == 3) { - if ((keystatus[0x1d]|keystatus[0x9d]) > 0) //CTRL - put sprite on ceiling + if (eitherCTRL) //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); + sprite[searchwall].z = spriteonceilingz(searchwall); } else { @@ -3666,6 +3725,7 @@ static void Keys3d(void) if (k == 0) { sprite[searchwall].z -= updownunits; + sprite[searchwall].z = max(sprite[searchwall].z,spriteonceilingz(searchwall)); sprintf(getmessage,"Sprite %d z = %d",searchwall,sprite[searchwall].z); message(getmessage); @@ -3674,7 +3734,10 @@ static void Keys3d(void) { for (i=0;i 0) || ((bstatus&2) && (bstatus&32))) // PGDN @@ -3710,10 +3773,10 @@ static void Keys3d(void) 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 += updownunits << ((keystatus[0x1d]|keystatus[0x9d])<<1); // JBF 20031128 + sprite[i].z += updownunits << (eitherCTRL<<1); // JBF 20031128 i = nextspritesect[i]; } - sector[searchsector].ceilingz += updownunits << ((keystatus[0x1d]|keystatus[0x9d])<<1); // JBF 20031128 + sector[searchsector].ceilingz += updownunits << (eitherCTRL<<1); // JBF 20031128 sprintf(getmessage,"Sector %d ceilingz = %d",searchsector,sector[searchsector].ceilingz); message(getmessage); @@ -3729,10 +3792,10 @@ static void Keys3d(void) 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 += updownunits << ((keystatus[0x1d]|keystatus[0x9d])<<1); // JBF 20031128 + sprite[i].z += updownunits << (eitherCTRL<<1); // JBF 20031128 i = nextspritesect[i]; } - sector[highlightsector[j]].ceilingz += updownunits << ((keystatus[0x1d]|keystatus[0x9d])<<1); // JBF 20031128 + sector[highlightsector[j]].ceilingz += updownunits << (eitherCTRL<<1); // JBF 20031128 sprintf(getmessage,"Sector %d ceilingz = %d",*highlightsector,sector[highlightsector[j]].ceilingz); message(getmessage); @@ -3749,10 +3812,10 @@ static void Keys3d(void) 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 += updownunits << ((keystatus[0x1d]|keystatus[0x9d])<<1); // JBF 20031128 + sprite[i].z += updownunits << (eitherCTRL<<1); // JBF 20031128 i = nextspritesect[i]; } - sector[searchsector].floorz += updownunits << ((keystatus[0x1d]|keystatus[0x9d])<<1); // JBF 20031128 + sector[searchsector].floorz += updownunits << (eitherCTRL<<1); // JBF 20031128 sprintf(getmessage,"Sector %d floorz = %d",searchsector,sector[searchsector].floorz); message(getmessage); @@ -3767,10 +3830,10 @@ static void Keys3d(void) tempint = getflorzofslope(highlightsector[j],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 += updownunits << ((keystatus[0x1d]|keystatus[0x9d])<<1); // JBF 20031128 + sprite[i].z += updownunits << (eitherCTRL<<1); // JBF 20031128 i = nextspritesect[i]; } - sector[highlightsector[j]].floorz += updownunits << ((keystatus[0x1d]|keystatus[0x9d])<<1); // JBF 20031128 + sector[highlightsector[j]].floorz += updownunits << (eitherCTRL<<1); // JBF 20031128 sprintf(getmessage,"Sector %d floorz = %d",*highlightsector,sector[highlightsector[j]].floorz); message(getmessage); @@ -3781,10 +3844,9 @@ static void Keys3d(void) sector[searchsector].ceilingz = sector[searchsector].floorz; if (searchstat == 3) { - if ((keystatus[0x1d]|keystatus[0x9d]) > 0) //CTRL - put sprite on ground + if (eitherCTRL) //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); + sprite[searchwall].z = spriteongroundz(searchwall); } else { @@ -3800,6 +3862,7 @@ static void Keys3d(void) if (k == 0) { sprite[searchwall].z += updownunits; + sprite[searchwall].z = min(sprite[searchwall].z,spriteongroundz(searchwall)); sprintf(getmessage,"Sprite %d z = %d",searchwall,sprite[searchwall].z); message(getmessage); @@ -3808,7 +3871,10 @@ static void Keys3d(void) { for (i=0;i 9) p += 8; - if (rate > 99) p += 8; - if (rate > 999) p += 8; + Bsprintf(tempbuf,"%4d",rate); if (xdimgame <= 640) p >>= 1; begindrawing(); @@ -3944,14 +4007,14 @@ static void Keys3d(void) - if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x20]==1) // ' d + if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_D]) // ' d /* { ShowHelpText("SectorEffector"); } */ { - keystatus[0x20] = 0; + keystatus[KEYSC_D] = 0; skill++; if (skill>MAXSKILL-1) skill=0; sprintf(tempbuf,"%s",SKILLMODE[skill]); @@ -3959,36 +4022,35 @@ static void Keys3d(void) message(tempbuf); } - begindrawing(); - if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x22]==1) // ' g + if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_G]) // ' g { - keystatus[0x22] = 0; + keystatus[KEYSC_G] = 0; tabgraphic++; if (tabgraphic > 2) tabgraphic = 0; if (tabgraphic) message("Graphics ON"); else message("Graphics OFF"); } - if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x2d]==1) // ' x + if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_X]) // ' x { - keystatus[0x2d] = 0; + keystatus[KEYSC_X] = 0; shadepreview=!shadepreview; if (shadepreview) message("Sprite shade preview ON"); else message("Sprite shade preview OFF"); } - if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x13]==1) // ' r + if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_R]) // ' r { - keystatus[0x13] = 0; + keystatus[KEYSC_R] = 0; framerateon=!framerateon; if (framerateon) message("Framerate ON"); else message("Framerate OFF"); } - if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x11]==1) // ' w + if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_W]) // ' w { - keystatus[0x11] = 0; + keystatus[KEYSC_W] = 0; nosprites++; if (nosprites>3) nosprites=0; Bsprintf(tempbuf,"%s",SPRDSPMODE[nosprites]); @@ -3996,18 +4058,18 @@ static void Keys3d(void) message(tempbuf); } - if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x15]==1) // ' y + if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_Y]) // ' y { - keystatus[0x15] = 0; + keystatus[KEYSC_Y] = 0; purpleon=!purpleon; if (nosprites>3) nosprites=0; if (purpleon) message("Purple ON"); else message("Purple OFF"); } - enddrawing(); - if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x2e]==1) // ' C + + if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_C]) // ' C { - keystatus[0x2e] = 0; + keystatus[KEYSC_C] = 0; switch (searchstat) { case 0: @@ -4017,6 +4079,9 @@ static void Keys3d(void) if (wall[i].picnum==temppicnum) wall[i].shade=tempshade; } + Bsprintf(tempbuf,"Walls with picnum %d have shade of %d",temppicnum,tempshade); + message(tempbuf); + asksave=1; break; case 1: case 2: @@ -4033,6 +4098,9 @@ static void Keys3d(void) sector[i].floorshade=tempshade; } } + Bsprintf(tempbuf,"Sectors with picnum %d have shade of %d",temppicnum,tempshade); + message(tempbuf); + asksave=1; break; case 3: for (i=0;i0) // F2 { usedcount=!usedcount; - keystatus[0x3c] = 0; + keystatus[KEYSC_F2] = 0; } - if (keystatus[0x0f]>0) // TAB : USED + if (keystatus[KEYSC_TAB]) // TAB : USED { // usedcount=!usedcount; @@ -4161,14 +4232,14 @@ static void Keys3d(void) } - if (keystatus[0x3b]==1) // F1 + if (keystatus[KEYSC_F1]) // F1 { helpon=!helpon; - keystatus[0x23]=0; - keystatus[0x3b]=0; + keystatus[KEYSC_H]=0; // delete this line? + keystatus[KEYSC_F1]=0; } - if ((keystatus[KEYSC_G] > 0)) // G + if (keystatus[KEYSC_G]) // G { switch (searchstat) { @@ -4207,7 +4278,7 @@ static void Keys3d(void) keystatus[KEYSC_G] = 0; } - if (keystatus[KEYSC_B] > 0) // B (clip Blocking xor) (3D) + if (keystatus[KEYSC_B]) // B (clip Blocking xor) (3D) { if (searchstat == 3) { @@ -4222,7 +4293,7 @@ static void Keys3d(void) { wall[searchwall].cstat ^= 1; // wall[searchwall].cstat &= ~64; - if ((wall[searchwall].nextwall >= 0) && ((keystatus[0x2a]|keystatus[0x36]) == 0)) + if ((wall[searchwall].nextwall >= 0) && (eitherSHIFT == 0)) { wall[wall[searchwall].nextwall].cstat &= ~(1+64); wall[wall[searchwall].nextwall].cstat |= (wall[searchwall].cstat&1); @@ -4234,7 +4305,7 @@ static void Keys3d(void) keystatus[KEYSC_B] = 0; } - if (keystatus[KEYSC_T] > 0) // T (transluscence for sprites/masked walls) + if (keystatus[KEYSC_T]) // T (transluscence for sprites/masked walls) { if (searchstat == 1) //Set masked/transluscent ceilings/floors { @@ -4279,7 +4350,7 @@ static void Keys3d(void) asksave = 1; } - if ((keystatus[KEYSC_QUOTE]) > 0) + if (keystatus[KEYSC_QUOTE]) { switch (searchstat) { @@ -4334,11 +4405,9 @@ static void Keys3d(void) keystatus[KEYSC_T] = 0; } - if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x1c]==1) // ' ENTER + if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_ENTER]) // ' ENTER { - begindrawing(); message("Pasted graphic only"); - enddrawing(); switch (searchstat) { case 0 : @@ -4357,7 +4426,7 @@ static void Keys3d(void) wall[searchwall].overpicnum = temppicnum; break; } - keystatus[0x1c]=0; + keystatus[KEYSC_ENTER]=0; } @@ -4434,9 +4503,9 @@ static void Keys2d(void) } enddrawing(); - if (keystatus[0x3b]==1 || (keystatus[KEYSC_QUOTE]==1 && keystatus[0x29]==1)) //F1 or ' ~ + if (keystatus[KEYSC_F1] || (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_TILDE])) //F1 or ' ~ { - keystatus[0x3b]=0; + keystatus[KEYSC_F1]=0; clearmidstatbar16(); begindrawing(); for (i=0;i 0) // M (tag) + if (keystatus[KEYSC_M]) // M (tag) { - keystatus[0x32] = 0; - if ((keystatus[0x38]|keystatus[0xb8]) > 0) //ALT + keystatus[KEYSC_M] = 0; + if (eitherALT) //ALT { if (pointhighlight >= 16384) { @@ -4507,11 +4577,11 @@ static void Keys2d(void) } } - if (keystatus[0x35] > 0) // /? Reset panning&repeat to 0 + if (keystatus[KEYSC_SLASH]) // /? Reset panning&repeat to 0 { if ((ppointhighlight&0xc000) == 16384) { - if ((keystatus[0x2a]|keystatus[0x36]) > 0) + if (eitherSHIFT) { sprite[cursprite].xrepeat = sprite[cursprite].yrepeat; } @@ -4521,18 +4591,18 @@ static void Keys2d(void) sprite[cursprite].yrepeat = 64; } } - keystatus[0x35] = 0; + keystatus[KEYSC_SLASH] = 0; asksave = 1; } - if ((keystatus[0x4b]|keystatus[0x4d]) > 0) // 4 & 6 (keypad) + if (keystatus[KEYSC_gLEFT] || keystatus[KEYSC_gRIGHT]) // 4 & 6 (keypad) { - smooshyalign = keystatus[0x4c]; + smooshyalign = keystatus[KEYSC_gKP5]; if ((repeatcountx == 0) || (repeatcountx > 16)) { changedir = 0; - if (keystatus[0x4b] > 0) changedir = -1; - if (keystatus[0x4d] > 0) changedir = 1; + if (keystatus[KEYSC_gLEFT]) changedir = -1; + if (keystatus[KEYSC_gRIGHT]) changedir = 1; if ((ppointhighlight&0xc000) == 16384) { @@ -4548,14 +4618,14 @@ static void Keys2d(void) else repeatcountx = 0; - if ((keystatus[0x48]|keystatus[0x50]) > 0) // 2 & 8 (keypad) + if (keystatus[KEYSC_gUP] || keystatus[KEYSC_gDOWN]) // 2 & 8 (keypad) { - smooshyalign = keystatus[0x4c]; + smooshyalign = keystatus[KEYSC_gKP5]; if ((repeatcounty == 0) || (repeatcounty > 16)) { changedir = 0; - if (keystatus[0x48] > 0) changedir = -1; - if (keystatus[0x50] > 0) changedir = 1; + if (keystatus[KEYSC_gUP]) changedir = -1; + if (keystatus[KEYSC_gDOWN]) changedir = 1; if ((ppointhighlight&0xc000) == 16384) { @@ -4572,7 +4642,7 @@ static void Keys2d(void) else repeatcounty = 0; - if (keystatus[0x13] > 0) // R (relative alignment, rotation) + if (keystatus[KEYSC_R]) // R (relative alignment, rotation) { if (pointhighlight >= 16384) { @@ -4592,7 +4662,7 @@ static void Keys2d(void) asksave = 1; } - keystatus[0x13] = 0; + keystatus[KEYSC_R] = 0; } @@ -4600,7 +4670,7 @@ static void Keys2d(void) { if (pointhighlight >= 16384) { - keystatus[0x1f] = 0; + keystatus[KEYSC_S] = 0; Bsprintf(tempbuf,"Sprite %d xrepeat: ",cursprite); sprite[cursprite].xrepeat=getnumber16(tempbuf, sprite[cursprite].xrepeat, 256,0); Bsprintf(tempbuf,"Sprite %d yrepeat: ",cursprite); @@ -4616,9 +4686,9 @@ static void Keys2d(void) FuncMenu(); } - if (keystatus[0x1a]>0) // [ search backward + if (keystatus[KEYSC_LBRACK]) // [ search backward { - keystatus[0x1a]=0; + keystatus[KEYSC_LBRACK]=0; if (wallsprite==0) { SearchSectorsBackward(); @@ -4642,7 +4712,7 @@ static void Keys2d(void) posy=(wall[i].y)-(((wall[i].y)-(wall[wall[i].point2].y))/2); printmessage16("< Wall search: found"); // curwallnum--; - keystatus[0x1a]=0; + keystatus[KEYSC_LBRACK]=0; return; } curwallnum--; @@ -4671,7 +4741,7 @@ static void Keys2d(void) ang= sprite[i].ang; printmessage16("< Sprite search: found"); // curspritenum--; - keystatus[0x1a]=0; + keystatus[KEYSC_LBRACK]=0; return; } cursearchspritenum--; @@ -4681,9 +4751,9 @@ static void Keys2d(void) } - if (keystatus[0x1b]>0) // ] search forward + if (keystatus[KEYSC_RBRACK]) // ] search forward { - keystatus[0x1b]=0; + keystatus[KEYSC_RBRACK]=0; if (wallsprite==0) { SearchSectorsForward(); @@ -4707,7 +4777,7 @@ static void Keys2d(void) posy=(wall[i].y)-(((wall[i].y)-(wall[wall[i].point2].y))/2); printmessage16("> Wall search: found"); // curwallnum++; - keystatus[0x1b]=0; + keystatus[KEYSC_RBRACK]=0; return; } curwallnum++; @@ -4735,7 +4805,7 @@ static void Keys2d(void) ang= sprite[i].ang; printmessage16("> Sprite search: found"); // curspritenum++; - keystatus[0x1b]=0; + keystatus[KEYSC_RBRACK]=0; return; } cursearchspritenum++; @@ -4744,9 +4814,9 @@ static void Keys2d(void) } } - if (keystatus[0x22] > 0) // G (grid on/off) + if (keystatus[KEYSC_G]) // G (grid on/off) { - grid += ((keystatus[0x2a]|keystatus[0x36]) > 0?-1:1); + grid += eitherSHIFT?-1:1; if (grid == -1 || grid == 9) { switch (grid) @@ -4762,10 +4832,10 @@ static void Keys2d(void) if (!grid) sprintf(tempbuf,"Grid off"); else sprintf(tempbuf,"Grid size: %d (%d units)",grid,2048>>grid); printmessage16(tempbuf); - keystatus[0x22] = 0; + keystatus[KEYSC_G] = 0; } - if ((keystatus[0x26] > 0) && (keystatus[KEYSC_QUOTE] > 0)) // ' L + if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_L]) // ' L { if (pointhighlight >= 16384) { @@ -4793,15 +4863,15 @@ static void Keys2d(void) printmessage16(tempbuf); } - keystatus[0x26] = 0; + keystatus[KEYSC_L] = 0; } - if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x04]==1) // ' 3 + if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_3]) // ' 3 { onnames++; if (onnames>8) onnames=0; - keystatus[0x04]=0; + keystatus[KEYSC_3]=0; Bsprintf(tempbuf,"Mode %d %s",onnames,SpriteMode[onnames]); printmessage16(tempbuf); // clearmidstatbar16(); @@ -4810,9 +4880,9 @@ static void Keys2d(void) // Ver(); /* - if(keystatus[KEYSC_QUOTE]==1 && keystatus[0x06]==1) // ' 5 + if(keystatus[KEYSC_QUOTE] && keystatus[KEYSC_5]) // ' 5 { - keystatus[0x06]=0; + keystatus[KEYSC_5]=0; sprintf(tempbuf,"Power-Up Ammo now equals Normal"); printmessage16(tempbuf); for(i=0;i 2) sidemode = 0; if (sidemode == 1) { @@ -4848,9 +4918,9 @@ static void Keys2d(void) } */ - if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x08]==1) // ' 7 : swap hilo + if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_7]) // ' 7 : swap hilo { - keystatus[0x08]=0; + keystatus[KEYSC_7]=0; if (pointhighlight >= 16384) { @@ -4870,13 +4940,13 @@ static void Keys2d(void) } } - if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x24]==1) // ' J + if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_J]) // ' J { posx=getnumber16("X-coordinate: ",posx,131072L,1); posy=getnumber16("Y-coordinate: ",posy,131072L,1); Bsprintf(tempbuf,"Current pos now (%d, %d)",posx,posy); printmessage16(tempbuf); - keystatus[0x24]=0; + keystatus[KEYSC_J]=0; } }// end key2d @@ -6297,15 +6367,15 @@ void ExtAnalyzeSprites(void) static void Keys2d3d(void) { int i, j; - if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x1e]==1) // ' a + if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_A]) // ' a { - keystatus[0x1e] = 0; + keystatus[KEYSC_A] = 0; autosave=!autosave; if (autosave) message("Autosave ON"); else message("Autosave OFF"); } - if (keystatus[KEYSC_QUOTE]==1 && keystatus[KEYSC_N]==1) // ' n + if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_N]) // ' n { keystatus[KEYSC_N] = 0; noclip=!noclip; @@ -6327,8 +6397,8 @@ static void Keys2d3d(void) autosavetimer = totalclock+120*180; } - if ((keystatus[0x1d]|keystatus[0x9d]) > 0) //CTRL - if (keystatus[0x1f] > 0) // S + if (eitherCTRL) //CTRL + if (keystatus[KEYSC_S]) // S { if (levelname[0]) { @@ -6348,11 +6418,11 @@ static void Keys2d3d(void) ExtSaveMap(f); message("Board saved"); asksave = 0; - keystatus[0x1f] = 0; + keystatus[KEYSC_S] = 0; } } - if (keystatus[buildkeys[14]] > 0) // Enter + if (keystatus[buildkeys[BK_MODE2D_3D]]) // Enter { getmessageleng = 0; getmessagetimeoff = 0; @@ -6468,7 +6538,7 @@ void faketimerhandler(void) if (yvel < 0) yvel++; if (yvel > 0) yvel--; - i = 4-keystatus[buildkeys[4]]; + i = 4-keystatus[buildkeys[BK_RUN]]; xvel += mulscale(vel,(int)sintable[(ang+512)&2047],i); yvel += mulscale(vel,(int)sintable[ang&2047],i); @@ -6502,9 +6572,9 @@ void faketimerhandler(void) if (horiz < 100) horiz++; if (horiz > 100) horiz--; - if (keystatus[KEYSC_QUOTE]==1 && keystatus[0x06]==1) // ' 5 + if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_5]) // ' 5 { - keystatus[0x06]=0; + keystatus[KEYSC_5]=0; editstatus = 1; sidemode = 2; } @@ -6570,7 +6640,7 @@ static void SearchSectorsForward() posy=wall[sector[ii].wallptr].y; printmessage16("> Sector search: found"); // cursectornum++; - keystatus[0x1b]=0; // ] + keystatus[KEYSC_RBRACK]=0; // ] return; } cursectornum++; @@ -6593,7 +6663,7 @@ static void SearchSectorsBackward() posy=wall[sector[ii].wallptr].y; printmessage16("< Sector search: found"); // cursectornum--; - keystatus[0x1a]=0; // [ + keystatus[KEYSC_LBRACK]=0; // [ return; } cursectornum--; @@ -6615,7 +6685,7 @@ static void EditSectorData(short sectnum) showsectordata(sectnum); begindrawing(); - while (keystatus[1] == 0) + while (keystatus[KEYSC_ESC] == 0) { if (handleevents()) { @@ -6623,25 +6693,25 @@ static void EditSectorData(short sectnum) } idle(); printmessage16("Edit mode, press to exit"); - if (keystatus[0xd0] > 0) + if (keystatus[KEYSC_DOWN]) { if (row < rowmax) { printext16(xpos,ypos+row*8,11,0,disptext,0); row++; } - keystatus[0xd0] = 0; + keystatus[KEYSC_DOWN] = 0; } - if (keystatus[0xc8] > 0) + if (keystatus[KEYSC_UP]) { if (row > 0) { printext16(xpos,ypos+row*8,11,0,disptext,0); row--; } - keystatus[0xc8] = 0; + keystatus[KEYSC_UP] = 0; } - if (keystatus[0xcb] > 0) + if (keystatus[KEYSC_LEFT]) { if (col == 2) { @@ -6653,9 +6723,9 @@ static void EditSectorData(short sectnum) disptext[dispwidth] = 0; if (row > rowmax) row = rowmax; } - keystatus[0xcb] = 0; + keystatus[KEYSC_LEFT] = 0; } - if (keystatus[0xcd] > 0) + if (keystatus[KEYSC_RIGHT]) { if (col == 1) { @@ -6667,11 +6737,11 @@ static void EditSectorData(short sectnum) disptext[dispwidth] = 0; if (row > rowmax) row = rowmax; } - keystatus[0xcd] = 0; + keystatus[KEYSC_RIGHT] = 0; } - if (keystatus[0x1c] > 0) + if (keystatus[KEYSC_ENTER]) { - keystatus[0x1c] = 0; + keystatus[KEYSC_ENTER] = 0; editval = 1; } @@ -6838,7 +6908,7 @@ static void EditSectorData(short sectnum) printmessage16(""); enddrawing(); showframe(1); - keystatus[1] = 0; + keystatus[KEYSC_ESC] = 0; } static void EditWallData(short wallnum) @@ -6852,7 +6922,7 @@ static void EditWallData(short wallnum) clearmidstatbar16(); showwalldata(wallnum); begindrawing(); - while (keystatus[1] == 0) + while (keystatus[KEYSC_ESC] == 0) { if (handleevents()) { @@ -6860,27 +6930,27 @@ static void EditWallData(short wallnum) } idle(); printmessage16("Edit mode, press to exit"); - if (keystatus[0xd0] > 0) + if (keystatus[KEYSC_DOWN]) { if (row < 6) { printext16(xpos,ypos+row*8,11,0,disptext,0); row++; } - keystatus[0xd0] = 0; + keystatus[KEYSC_DOWN] = 0; } - if (keystatus[0xc8] > 0) + if (keystatus[KEYSC_UP]) { if (row > 0) { printext16(xpos,ypos+row*8,11,0,disptext,0); row--; } - keystatus[0xc8] = 0; + keystatus[KEYSC_UP] = 0; } - if (keystatus[0x1c] > 0) + if (keystatus[KEYSC_ENTER]) { - keystatus[0x1c] = 0; + keystatus[KEYSC_ENTER] = 0; editval = 1; } switch (row) @@ -6971,7 +7041,7 @@ static void EditWallData(short wallnum) printmessage16(""); enddrawing(); showframe(1); - keystatus[1] = 0; + keystatus[KEYSC_ESC] = 0; } static void EditSpriteData(short spritenum) @@ -6985,7 +7055,7 @@ static void EditSpriteData(short spritenum) clearmidstatbar16(); showspritedata(spritenum); - while (keystatus[1] == 0) + while (keystatus[KEYSC_ESC] == 0) { begindrawing(); if (handleevents()) @@ -6994,25 +7064,25 @@ static void EditSpriteData(short spritenum) } idle(); printmessage16("Edit mode, press to exit"); - if (keystatus[0xd0] > 0) + if (keystatus[KEYSC_DOWN]) { if (row < rowmax) { printext16(xpos,ypos+row*8,11,0,disptext,0); row++; } - keystatus[0xd0] = 0; + keystatus[KEYSC_DOWN] = 0; } - if (keystatus[0xc8] > 0) + if (keystatus[KEYSC_UP]) { if (row > 0) { printext16(xpos,ypos+row*8,11,0,disptext,0); row--; } - keystatus[0xc8] = 0; + keystatus[KEYSC_UP] = 0; } - if (keystatus[0xcb] > 0) + if (keystatus[KEYSC_LEFT]) { switch (col) { @@ -7039,9 +7109,9 @@ static void EditSpriteData(short spritenum) } break; } - keystatus[0xcb] = 0; + keystatus[KEYSC_LEFT] = 0; } - if (keystatus[0xcd] > 0) + if (keystatus[KEYSC_RIGHT]) { switch (col) { @@ -7068,11 +7138,11 @@ static void EditSpriteData(short spritenum) } break; } - keystatus[0xcd] = 0; + keystatus[KEYSC_RIGHT] = 0; } - if (keystatus[0x1c] > 0) + if (keystatus[KEYSC_ENTER]) { - keystatus[0x1c] = 0; + keystatus[KEYSC_ENTER] = 0; editval = 1; } switch (col) @@ -7321,7 +7391,7 @@ static void EditSpriteData(short spritenum) printmessage16(""); enddrawing(); showframe(1); - keystatus[1] = 0; + keystatus[KEYSC_ESC] = 0; } // Build edit @@ -7396,7 +7466,7 @@ static void FuncMenu(void) FuncMenuOpts(); - while (!editval && keystatus[1] == 0) + while (!editval && keystatus[KEYSC_ESC] == 0) { begindrawing(); if (handleevents()) @@ -7405,25 +7475,25 @@ static void FuncMenu(void) } idle(); printmessage16("Select an option, press to exit"); - if (keystatus[0xd0] > 0) + if (keystatus[KEYSC_DOWN]) { if (row < rowmax) { printext16(xpos,ypos+row*8,11,0,disptext,0); row++; } - keystatus[0xd0] = 0; + keystatus[KEYSC_DOWN] = 0; } - if (keystatus[0xc8] > 0) + if (keystatus[KEYSC_UP]) { if (row > 0) { printext16(xpos,ypos+row*8,11,0,disptext,0); row--; } - keystatus[0xc8] = 0; + keystatus[KEYSC_UP] = 0; } - if (keystatus[0xcb] > 0) + if (keystatus[KEYSC_LEFT]) { /* if (col == 2) { @@ -7446,9 +7516,9 @@ static void FuncMenu(void) disptext[dispwidth] = 0; if (row > rowmax) row = rowmax; } - keystatus[0xcb] = 0; + keystatus[KEYSC_LEFT] = 0; } - if (keystatus[0xcd] > 0) + if (keystatus[KEYSC_RIGHT]) { if (col == 0) { @@ -7470,11 +7540,11 @@ static void FuncMenu(void) disptext[dispwidth] = 0; if (row > rowmax) row = rowmax; } */ - keystatus[0xcd] = 0; + keystatus[KEYSC_RIGHT] = 0; } - if (keystatus[0x1c] > 0) + if (keystatus[KEYSC_ENTER]) { - keystatus[0x1c] = 0; + keystatus[KEYSC_ENTER] = 0; editval = 1; } switch (col) @@ -7728,5 +7798,5 @@ static void FuncMenu(void) enddrawing(); clearmidstatbar16(); showframe(1); - keystatus[1] = 0; + keystatus[KEYSC_ESC] = 0; } diff --git a/polymer/eduke32/source/keys.h b/polymer/eduke32/source/keys.h index fbf20155e..052d237b2 100644 --- a/polymer/eduke32/source/keys.h +++ b/polymer/eduke32/source/keys.h @@ -33,100 +33,117 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #define ESC 0x1B #define ENTER 0x0D - #define KEYSC_ESC 1 - #define KEYSC_1 2 - #define KEYSC_2 3 - #define KEYSC_3 4 - #define KEYSC_4 5 - #define KEYSC_5 6 - #define KEYSC_6 7 - #define KEYSC_7 8 - #define KEYSC_8 9 - #define KEYSC_9 10 - #define KEYSC_0 11 - #define KEYSC_DASH 12 - #define KEYSC_EQUAL 13 + #define KEYSC_ESC 0x01 + #define KEYSC_1 0x02 + #define KEYSC_2 0x03 + #define KEYSC_3 0x04 + #define KEYSC_4 0x05 + #define KEYSC_5 0x06 + #define KEYSC_6 0x07 + #define KEYSC_7 0x08 + #define KEYSC_8 0x09 + #define KEYSC_9 0x0a + #define KEYSC_0 0x0b + #define KEYSC_DASH 0x0c + #define KEYSC_EQUAL 0x0d - #define KEYSC_BS 14 - #define KEYSC_TAB 15 - #define KEYSC_Q 16 - #define KEYSC_W 17 - #define KEYSC_E 18 - #define KEYSC_R 19 - #define KEYSC_T 20 - #define KEYSC_Y 21 - #define KEYSC_U 22 - #define KEYSC_I 23 - #define KEYSC_O 24 - #define KEYSC_P 25 - #define KEYSC_LBRACK 26 - #define KEYSC_RBRACK 27 - #define KEYSC_ENTER 28 + #define KEYSC_BS 0x0e + #define KEYSC_TAB 0x0f + #define KEYSC_Q 0x10 + #define KEYSC_W 0x11 + #define KEYSC_E 0x12 + #define KEYSC_R 0x13 + #define KEYSC_T 0x14 + #define KEYSC_Y 0x15 + #define KEYSC_U 0x16 + #define KEYSC_I 0x17 + #define KEYSC_O 0x18 + #define KEYSC_P 0x19 + #define KEYSC_LBRACK 0x1a + #define KEYSC_RBRACK 0x1b + #define KEYSC_ENTER 0x1c - #define KEYSC_CTRL 29 - #define KEYSC_A 30 - #define KEYSC_S 31 - #define KEYSC_D 32 - #define KEYSC_F 33 - #define KEYSC_G 34 - #define KEYSC_H 35 - #define KEYSC_J 36 - #define KEYSC_K 37 - #define KEYSC_L 38 - #define KEYSC_SEMI 39 - #define KEYSC_QUOTE 40 - #define KEYSC_BQUOTE 41 - #define KEYSC_TILDE 41 + #define KEYSC_LCTRL 0x1d + #define KEYSC_A 0x1e + #define KEYSC_S 0x1f + #define KEYSC_D 0x20 + #define KEYSC_F 0x21 + #define KEYSC_G 0x22 + #define KEYSC_H 0x23 + #define KEYSC_J 0x24 + #define KEYSC_K 0x25 + #define KEYSC_L 0x26 + #define KEYSC_SEMI 0x27 + #define KEYSC_QUOTE 0x28 + #define KEYSC_BQUOTE 0x29 + #define KEYSC_TILDE 0x29 - #define KEYSC_LSHIFT 42 - #define KEYSC_BSLASH 43 - #define KEYSC_Z 44 - #define KEYSC_X 45 - #define KEYSC_C 46 - #define KEYSC_V 47 - #define KEYSC_B 48 - #define KEYSC_N 49 - #define KEYSC_M 50 - #define KEYSC_COMMA 51 - #define KEYSC_PERIOD 52 - #define KEYSC_SLASH 53 - #define KEYSC_RSHIFT 54 - #define KEYSC_STAR 55 + #define KEYSC_LSHIFT 0x2a + #define KEYSC_BSLASH 0x2b + #define KEYSC_Z 0x2c + #define KEYSC_X 0x2d + #define KEYSC_C 0x2e + #define KEYSC_V 0x2f + #define KEYSC_B 0x30 + #define KEYSC_N 0x31 + #define KEYSC_M 0x32 + #define KEYSC_COMMA 0x33 + #define KEYSC_PERIOD 0x34 + #define KEYSC_SLASH 0x35 + #define KEYSC_RSHIFT 0x36 + #define KEYSC_gSTAR 0x37 - #define KEYSC_ALT 56 - #define KEYSC_SPACE 57 - #define KEYSC_CAPS 58 + #define KEYSC_LALT 0x38 + #define KEYSC_SPACE 0x39 + #define KEYSC_CAPS 0x3a - #define KEYSC_F1 59 - #define KEYSC_F2 60 - #define KEYSC_F3 61 - #define KEYSC_F4 62 - #define KEYSC_F5 63 - #define KEYSC_F6 64 - #define KEYSC_F7 65 - #define KEYSC_F8 66 - #define KEYSC_F9 67 - #define KEYSC_F10 68 + #define KEYSC_F1 0x3b + #define KEYSC_F2 0x3c + #define KEYSC_F3 0x3d + #define KEYSC_F4 0x3e + #define KEYSC_F5 0x3f + #define KEYSC_F6 0x40 + #define KEYSC_F7 0x41 + #define KEYSC_F8 0x42 + #define KEYSC_F9 0x43 + #define KEYSC_F10 0x44 + + #define KEYSC_gNUM 0x45 + #define KEYSC_SCROLL 0x46 + + #define KEYSC_gHOME 0x47 + #define KEYSC_gUP 0x48 + #define KEYSC_gPGUP 0x49 + #define KEYSC_gMINUS 0x4a + #define KEYSC_gLEFT 0x4b + #define KEYSC_gKP5 0x4c + #define KEYSC_gRIGHT 0x4d + #define KEYSC_gPLUS 0x4e + #define KEYSC_gEND 0x4f + #define KEYSC_gDOWN 0x50 + #define KEYSC_gPGDN 0x51 + #define KEYSC_gINS 0x52 + #define KEYSC_gDEL 0x53 #define KEYSC_F11 0x57 #define KEYSC_F12 0x58 - #define KEYSC_NUM 69 - #define KEYSC_SCROLL 70 - - #define KEYSC_HOME 71 - #define KEYSC_UP 72 - #define KEYSC_PGUP 73 - #define KEYSC_GMINUS 74 - #define KEYSC_LEFT 75 - #define KEYSC_KP5 76 - #define KEYSC_RIGHT 77 - #define KEYSC_GPLUS 78 - #define KEYSC_END 79 - #define KEYSC_DOWN 80 - #define KEYSC_PGDN 81 - #define KEYSC_INS 82 - #define KEYSC_DEL 83 + #define KEYSC_gENTER 0x9C + #define KEYSC_RCTRL 0x9D + #define KEYSC_gSLASH 0xB5 + #define KEYSC_RALT 0xB8 + #define KEYSC_PRTSCN 0xB7 + #define KEYSC_PAUSE 0xC5 + #define KEYSC_HOME 0xC7 + #define KEYSC_UP 0xC8 + #define KEYSC_PGUP 0xC9 + #define KEYSC_LEFT 0xCB + #define KEYSC_RIGHT 0xCD + #define KEYSC_END 0xCF + #define KEYSC_DOWN 0xD0 + #define KEYSC_PGDN 0xD1 + #define KEYSC_INSERT 0xD2 + #define KEYSC_DELETE 0xD3 #define asc_Esc 27 #define asc_Enter 13