From 30877e925ac4aa99eacc3b07ebed49f2784df222 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sat, 22 May 2010 14:04:47 +0000 Subject: [PATCH] more polymer-override variable twiddling in m32script, fixes and beautifying. git-svn-id: https://svn.eduke32.com/eduke32@1648 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/a.m32 | 353 ++++++++++++++++++---- polymer/eduke32/build/include/editor.h | 2 + polymer/eduke32/build/src/build.c | 310 ++++++++----------- polymer/eduke32/build/src/osd.c | 4 +- polymer/eduke32/m32script_ex.map | Bin 17242 -> 30498 bytes polymer/eduke32/source/astub.c | 169 ++++++----- polymer/eduke32/source/m32exec.c | 20 +- polymer/eduke32/source/sounds_mapster32.c | 2 +- 8 files changed, 540 insertions(+), 320 deletions(-) diff --git a/polymer/eduke32/a.m32 b/polymer/eduke32/a.m32 index 5a8880d5f..a556cde1b 100644 --- a/polymer/eduke32/a.m32 +++ b/polymer/eduke32/a.m32 @@ -11,12 +11,23 @@ gamevar l 0 1 gamevar m 0 1 gamevar p 0 1 gamevar q 0 1 +gamevar r 0 1 + +gamevar x 0 0 +gamevar y 0 0 +gamevar z 0 0 gamevar gi 0 0 gamevar gj 0 0 gamevar gk 0 0 +gamevar dx 0 0 +gamevar dy 0 0 +gamevar dz 0 0 +gamevar dang 0 0 + gamevar tmp 0 0 +gamevar cnt 0 0 gamevar davr 65536 0 gamevar dayx 65536 0 @@ -65,6 +76,19 @@ definequote 25 WALL[%d].NEXTSECTOR=%d out of range: numsectors=%d!!! definequote 26 FLOAT ACCESS TEST +definequote 27 OVERRIDE POLYMER PARALLAX & SPECULAR: OFF +definequote 28 OVERRIDE POLYMER PARALLAX & SPECULAR: ON + +definequote 29 PARALLAX SCALE: %f +definequote 30 PARALLAX BIAS: %f +definequote 31 SPECULAR FACTOR: %f +definequote 32 SPECULAR POWER: %f + +define PRSCALE 1000 +// NOTE: inline constants >=32768 are sometimes broken ATM (when loading a second time?). +// This should always work +define MAXSPECULAR 100000 + gamearray ar 128 gamearray parm 8 @@ -136,27 +160,107 @@ defstate printlights ends // convenient polymer SE light manipulation with keypad keys +// when aiming at light SE (49 or 50): +// KP 4,5,6,8: angle/horiz +// KP 7,9: range +// KP+/-: radius +// KP 1,2,3: RGB color (Shift inverts) +// +// when aiming at wall or sector: +// KP/ enable/disable overrides +// when overrides are on: +// KP 4,7: parallaxscale +// KP 8,9: parallaxbias +// KP 1,2: specularfactor +// KP 3,6: specularpower +// +// Also try Shift and/or Ctrl modifiers for different increments defstate fiddlewithlights - ifn searchstat 0 ifn searchstat 4 nullop - else + ife searchstat 3 nullop else { - // polymer override parallaxscale - set j 0 - ifhitkey KEY_KP8 set j 1 - ifhitkey KEY_KP5 set j -1 - ifeithershift nullop else mul j 10 - - ifn j 0 + ifhitkey KEY_gSLASH { - set k pr_parallaxscale // also available: ~bias, specularfactor, ~power - ftoi k 2000000 // must convert to scaled integer - add k j - itof k 2000000 // convert back - set pr_parallaxscale k + ife pr_overrideparallax 0 + { + set pr_overrideparallax 1 + set pr_overridespecular 1 + quote 28 + } + else + { + set pr_overrideparallax 0 + set pr_overridespecular 0 + quote 27 + } } - } + // if aiming at sector or wall + ife searchstat 3 nullop + else ifn pr_overrideparallax 0 + { + // polymer override parallaxscale + set j 0 set k 0 + + ifhitkey KEY_KP4 set j -1 + ifhitkey KEY_KP7 set j 1 + ifn j 0 set k 1 + + ifhitkey KEY_KP8 set j -1 + ifhitkey KEY_KP9 set j 1 + ife k 0 ifn j 0 set k 2 + + ifhitkey KEY_KP1 set j -1 + ifhitkey KEY_KP2 set j 1 + ife k 0 ifn j 0 set k 3 + + ifhitkey KEY_KP3 set j -1 + ifhitkey KEY_KP6 set j 1 + ife k 0 ifn j 0 set k 4 + + ifeithershift mul j 2 else mul j 10 + ifeitherctrl mul j 10 + + switch k + case 0: break; + case 1: + { + set k pr_parallaxscale + ftoi k PRSCALE // must convert to scaled integer, scale is 1:PRSCALE + add k j, clamp k -10000 10000 + itof k PRSCALE // convert back + qsprintf TQUOTE 29 k, quote TQUOTE + set pr_parallaxscale k + break; + } + case 2: + { + set k pr_parallaxbias + ftoi k PRSCALE, add k j, clamp k -10000 10000, itof k PRSCALE + qsprintf TQUOTE 30 k, quote TQUOTE + set pr_parallaxbias k + break; + } + case 3: + { + set k pr_specularfactor + ftoi k PRSCALE, add k j, clamp k -10000 MAXSPECULAR, itof k PRSCALE + qsprintf TQUOTE 31 k, quote TQUOTE + set pr_specularfactor k + break; + } + case 4: + { + set k pr_specularpower + ftoi k PRSCALE, add k j, clamp k -10000 MAXSPECULAR, itof k PRSCALE + qsprintf TQUOTE 32 k, quote TQUOTE + set pr_specularpower k + break; + } + endswitch + } + + // if aiming at an SE with lotag 49 or 50 ife searchstat 3 ife sprite[searchwall].picnum SECTOREFFECTOR ifge sprite[searchwall].lotag 49 ifle sprite[searchwall].lotag 50 { @@ -252,6 +356,7 @@ defstate fiddlewithlights } ends +/* defstate testkeyavail for i range 27 { @@ -271,10 +376,46 @@ defstate testkeyavail } } ends +*/ -//onevent EVENT_PREKEYS2D +// rotate highlighted sprites around selected (closest to mouse) sprite +// global parameter: dang +defstate rotselspr + ifg highlightcnt 0 + ifge pointhighlight 16384, ifl pointhighlight 32768 + { + ife dang 0 return + + set p pointhighlight, and p 16383 + + add sprite[p].ang dang + + for i selsprites, ifn i p + { + rotatepoint sprite[p].x sprite[p].y .x .y dang (x y) + add .ang dang + bsetsprite I x y .z + } + } +ends + +onevent EVENT_PREKEYS2D // state testkeyavail -//endevent + + set j 0 + ifeitherctrl + { + ifhitkey KEY_COMMA set j -1 + ifhitkey KEY_PERIOD set j 1 + } + + ifn j 0 + { + mul j 512 + set dang j + state rotselspr + } +endevent onevent EVENT_PREKEYS3D // state testkeyavail @@ -347,26 +488,45 @@ onevent EVENT_INSERTSPRITE2D } endevent -// rotates and duplicates selected sprites around -// pivot sprite (extra=123, ang:dang, yrepeat<<5:dz (pos. if pal!=0), lo:cnt) + +//////////////////// SPRITE DUPLICATORS //////////////////// + +defstate transcnt + ifle cnt 0 { inv cnt, add cnt 128 } +ends + +define DUP_ROT_MAGIC 123 + +// duplicates and rotates selected sprites around +// pivot sprite with fields +// .extra=123 (magic) +// .ang: angle delta +// .yrepeat*32: z delta (positive if pal!=0, i.e. going down) +// .shade: count (-128 to 0 -> 255 to 128) defstate duprot ifn searchstat 3 return - ifn sprite[searchwall].extra 123 return - ifl sprite[searchwall].shade 1 return - set k searchwall + ifn sprite[searchwall].extra DUP_ROT_MAGIC return - for i range sprite[k].shade + set p searchwall // pivot sprite + set cnt sprite[p].shade, state transcnt + + set sprite[p].extra -1 + + for i range cnt { - for j selsprites, ifn j k + for j selsprites, ifn j p { - dupsprite j - set tmp i, add tmp 1, mul tmp sprite[k].ang - rotatepoint sprite[k].x sprite[k].y .x .y tmp (l m) - add .ang tmp - set tmp i, add tmp 1, mul tmp sprite[k].yrepeat, shiftl tmp 5 - ife sprite[k].pal 0 inv tmp - add tmp .z - bsetsprite I l m tmp + dupsprite j // duplicate sprite j, I becomes index of newly created sprite + + set dang i, add dang 1, mul dang sprite[p].ang + rotatepoint sprite[p].x sprite[p].y .x .y dang (x y) + add .ang dang + + set z i, add z 1, mul z sprite[p].yrepeat, shiftl z 5 + ife sprite[p].pal 0, inv z + add z .z + + bsetsprite I x y z } } ends @@ -374,33 +534,120 @@ ends // same as above but with tsprite[], as a kind of preview defstate tduprot ifn searchstat 3 return - ifn sprite[searchwall].extra 123 return - ifl sprite[searchwall].shade 1 return - set k searchwall + ifn sprite[searchwall].extra DUP_ROT_MAGIC return - for i range sprite[k].shade + set p searchwall // pivot sprite + set cnt sprite[p].shade, state transcnt + + for i range cnt { - for j selsprites, ifn j k + for j selsprites, ifn j p { - set p spritesortcnt + set k spritesortcnt tdupsprite j - set tmp i, add tmp 1, mul tmp sprite[k].ang - rotatepoint sprite[k].x sprite[k].y tsprite[p].x tsprite[p].y tmp (l m) - add tsprite[p].ang tmp - set tmp i, add tmp 1, mul tmp sprite[k].yrepeat, shiftl tmp 5 - ife sprite[k].pal 0 inv tmp - add tmp tsprite[p].z - set tsprite[p].x l - set tsprite[p].y m - set tsprite[p].z tmp - or tsprite[p].cstat 514 -// bsetsprite I l m tmp + + set dang i, add dang 1, mul dang sprite[p].ang + rotatepoint sprite[p].x sprite[p].y tsprite[k].x tsprite[k].y dang (x y) + add tsprite[k].ang dang + + set z i, add z 1, mul z sprite[p].yrepeat, shiftl z 5 + ife sprite[p].pal 0 inv z + add z tsprite[k].z + + set tsprite[k].x x + set tsprite[k].y y + set tsprite[k].z z + + or tsprite[k].cstat 514 + } + } +ends + +define DUP_LIN_MAGIC 234 +define DUP_LIN_MAGIC2 345 + +// duplicates and translates selected sprites in the direction between two +// reference sprites with fields +// .extra=234 (1st sprite), =345 (2nd, aimed at sprite) +// .shade: count (-128 to 0 -> 255 to 128) +defstate duplin + ifn searchstat 3 return + ifn sprite[searchwall].extra DUP_LIN_MAGIC2 return + + set r searchwall // 2nd reference point + + set cnt sprite[r].shade, state transcnt + + set p -1 // 1st reference point + for i selsprites, ifn i r + { + ife .extra DUP_LIN_MAGIC { set p i, break } + } + ifl p 0 return + + set sprite[p].extra -1 + set sprite[r].extra -1 + + set dx sprite[r].x, sub dx sprite[p].x + set dy sprite[r].y, sub dy sprite[p].y + set dz sprite[r].z, sub dz sprite[p].z + + for i range cnt + { + for j selsprites, ifn j r + { + dupsprite j + + set x i, add x 1, mul x dx, add x .x + set y i, add y 1, mul y dy, add y .y + set z i, add z 1, mul z dz, add z .z + bsetsprite I x y z + } + } +ends + +defstate tduplin + ifn searchstat 3 return + ifn sprite[searchwall].extra DUP_LIN_MAGIC2 return + + set r searchwall // 2nd reference point + + set cnt sprite[r].shade, state transcnt + + set p -1 // 1st reference point + for i selsprites, ifn i r + { + ife .extra DUP_LIN_MAGIC { set p i, break } + } + ifl p 0 return + + set dx sprite[r].x, sub dx sprite[p].x + set dy sprite[r].y, sub dy sprite[p].y + set dz sprite[r].z, sub dz sprite[p].z + + for i range cnt + { + for j selsprites, ifn j r + { + set k spritesortcnt + tdupsprite j + + set tmp i, add tmp 1, mul tmp dx + add tsprite[k].x tmp + set tmp i, add tmp 1, mul tmp dy + add tsprite[k].y tmp + set tmp i, add tmp 1, mul tmp dz + add tsprite[k].z tmp + + or tsprite[k].cstat 514 +// bsetsprite I x y z } } ends onevent EVENT_ANALYZESPRITES state tduprot + state tduplin /* for i drawnsprites { @@ -517,10 +764,13 @@ onevent EVENT_KEYS3D } } } - else ife sprite[searchwall].extra 123 + else ife sprite[searchwall].extra DUP_ROT_MAGIC { state duprot - add sprite[searchwall].extra 1 + } + else ife sprite[searchwall].extra DUP_LIN_MAGIC2 + { + state duplin } } @@ -583,6 +833,7 @@ gamevar endwall 0 0 defstate corruptchk ifle numsectors MAXSECTORS ifle numwalls MAXWALLS nullop else { quote 19 printmessage16 19 return } + set ewall 0 // expected wall index for i allsectors { diff --git a/polymer/eduke32/build/include/editor.h b/polymer/eduke32/build/include/editor.h index b5954819f..9337ec772 100644 --- a/polymer/eduke32/build/include/editor.h +++ b/polymer/eduke32/build/include/editor.h @@ -130,6 +130,8 @@ static inline int32_t wallength(int16_t i) return ksqrt(dax*dax + day*day); } +#define CLEARLINES2D(Startline, Numlines, Color) clearbuf((char *)(frameplace + ((Startline)*bytesperline)), (bytesperline*(Numlines))>>2, (Color)) + #ifdef __cplusplus } #endif diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 34563de83..d3b4676c1 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -286,8 +286,8 @@ static int32_t osdcmd_vidmode(const osdfuncparm_t *parm) ydim2d = ydim; begindrawing(); //{{{ - clearbuf((char *)(frameplace + (ydim16*bytesperline)), (bytesperline*STATUS2DSIZ2) >> 2, 0x00000000l); - clearbuf((char *)frameplace, (ydim16*bytesperline) >> 2, 0L); + + CLEARLINES2D(0, ydim16+STATUS2DSIZ, 0); ydim16 = ydim; // drawline16(0,ydim-STATUS2DSIZ,xdim-1,ydim-STATUS2DSIZ,editorcolors[1]); @@ -1107,8 +1107,8 @@ void editinput(void) { sprite[i].cstat = (sprite[i].cstat&~48)|(16+64); if (hitinfo.hitwall >= 0) - sprite[i].ang = ((getangle(POINT2(hitinfo.hitwall).x-wall[hitinfo.hitwall].x, - POINT2(hitinfo.hitwall).y-wall[hitinfo.hitwall].y)+512)&2047); + sprite[i].ang = (getangle(POINT2(hitinfo.hitwall).x-wall[hitinfo.hitwall].x, + POINT2(hitinfo.hitwall).y-wall[hitinfo.hitwall].y)+512)&2047; //Make sure sprite's in right sector if (inside(sprite[i].x,sprite[i].y,sprite[i].sectnum) == 0) @@ -1175,10 +1175,11 @@ void editinput(void) if (keystatus[buildkeys[BK_MODE2D_3D]]) // Enter { double gamma = vid_gamma; - keystatus[buildkeys[BK_MODE2D_3D]] = 0; vid_gamma = 1.0; setbrightness(0,palette,0); + keystatus[buildkeys[BK_MODE2D_3D]] = 0; overheadeditor(); + keystatus[buildkeys[BK_MODE2D_3D]] = 0; vid_gamma = gamma; setbrightness(brightness,palette,0); } @@ -1283,8 +1284,8 @@ void overheadeditor(void) oposz = pos.z; begindrawing(); //{{{ - clearbuf((char *)(frameplace + (ydim16*bytesperline)), (bytesperline*STATUS2DSIZ2) >> 2, 0x00000000l); - clearbuf((char *)frameplace, (ydim16*bytesperline) >> 2, 0L); + + CLEARLINES2D(0, ydim, 0); ydim16 = ydim; // drawline16(0,ydim-STATUS2DSIZ2,xdim-1,ydim-STATUS2DSIZ2,editorcolors[1]); @@ -1696,10 +1697,10 @@ void overheadeditor(void) { int32_t about_x=keystatus[0x2d]; - keystatus[0x2d] = keystatus[0x15] = 0; - if (highlightsectorcnt > 0) { + keystatus[0x2d] = keystatus[0x15] = 0; + k = 0; dax = 0; day = 0; @@ -3153,7 +3154,7 @@ SKIP: split = 0; //clearbufbyte(&wall[newnumwalls],sizeof(walltype),0L); - memset(&wall[newnumwalls],0,sizeof(walltype)); + Bmemset(&wall[newnumwalls],0,sizeof(walltype)); wall[newnumwalls].extra = -1; wall[newnumwalls].x = mousxplc; @@ -3231,7 +3232,7 @@ SKIP: if (bad == 0) { //clearbufbyte(&wall[newnumwalls],sizeof(walltype),0L); - memset(&wall[newnumwalls],0,sizeof(walltype)); + Bmemset(&wall[newnumwalls],0,sizeof(walltype)); wall[newnumwalls].extra = -1; wall[newnumwalls].x = mousxplc; @@ -3269,7 +3270,7 @@ SKIP: flipwalls(numwalls,newnumwalls); //clearbufbyte(§or[numsectors],sizeof(sectortype),0L); - memset(§or[numsectors],0,sizeof(sectortype)); + Bmemset(§or[numsectors],0,sizeof(sectortype)); sector[numsectors].extra = -1; sector[numsectors].wallptr = numwalls; @@ -3338,7 +3339,7 @@ SKIP: flipwalls(numwalls,newnumwalls); //clearbufbyte(§or[numsectors],sizeof(sectortype),0L); - memset(§or[numsectors],0,sizeof(sectortype)); + Bmemset(§or[numsectors],0,sizeof(sectortype)); sector[numsectors].extra = -1; sector[numsectors].wallptr = numwalls; @@ -4973,18 +4974,18 @@ int32_t overridepm16y = -1; void clearmidstatbar16(void) { - int32_t x = overridepm16y<0 ? STATUS2DSIZ : overridepm16y; + int32_t y = overridepm16y<0 ? STATUS2DSIZ : overridepm16y; begindrawing(); - ydim16 = ydim; +// ydim16 = ydim; // clearbuf((char *)(frameplace + (bytesperline*(ydim-STATUS2DSIZ+25L))),(bytesperline*(STATUS2DSIZ-1-(25<<1))) >> 2, 0x08080808l); - clearbuf((char *)(frameplace + (bytesperline*(ydim-x+25L))), (bytesperline*(STATUS2DSIZ+2-(25<<1))) >> 2, 0x00000000l); - /* - drawline16(0,ydim-STATUS2DSIZ,0,ydim-1,editorcolors[7]); - drawline16base(xdim,ydim, -1,-STATUS2DSIZ, -1,-1, editorcolors[7]); - */ + CLEARLINES2D(ydim-y+25, STATUS2DSIZ+2-(25<<1), 0); + +// drawline16(0,ydim-STATUS2DSIZ,0,ydim-1,editorcolors[7]); +// drawline16base(xdim,ydim, -1,-STATUS2DSIZ, -1,-1, editorcolors[7]); + ydim16 = ydim-STATUS2DSIZ2; enddrawing(); } @@ -4992,22 +4993,23 @@ void clearmidstatbar16(void) static void clearministatbar16(void) { int32_t i, col = whitecol - 21; - char tempbuf[32]; + static const char *tempbuf = "Mapster32" VERSION; + begindrawing(); for (i=ydim-STATUS2DSIZ2; i> 2, 0l); + + CLEARLINES2D(0, ydim16, 0); if (pathsearchmode) Bstrcpy(buffer,"Local filesystem mode; press F for game filesystem."); @@ -5343,7 +5346,7 @@ static int32_t menuselect(void) for (i=0; ((inext) { int32_t c = (dir->type == CACHE1D_FIND_DIR ? 2 : 3); //PK - memset(buffer,0,sizeof(buffer)); + Bmemset(buffer,0,sizeof(buffer)); Bstrncpy(buffer,dir->name,25); if (Bstrlen(buffer) == 25) buffer[21] = buffer[22] = buffer[23] = '.', buffer[24] = 0; @@ -5539,7 +5542,7 @@ static int32_t menuselect(void) ch = 0; begindrawing(); - clearbuf((char *)frameplace, (bytesperline*ydim16) >> 2, 0l); + CLEARLINES2D(0, ydim16, 0); enddrawing(); showframe(1); } @@ -5703,7 +5706,7 @@ int32_t loadnames(void) } //clearbufbyte(names, sizeof(names), 0); - memset(names,0,sizeof(names)); + Bmemset(names,0,sizeof(names)); initprintf("Loading NAMES.H\n"); @@ -5830,9 +5833,9 @@ void printcoords16(int32_t posxe, int32_t posye, int16_t ange) m = (numsectors > MAXSECTORSV7 || numwalls > MAXWALLSV7 || numsprites > MAXSPRITESV7); Bsprintf(snotbuf,"%d/%d sect. %d/%d walls %d/%d spri.", - numsectors,m?MAXSECTORSV8:MAXSECTORSV7, - numwalls,m?MAXWALLSV8:MAXWALLSV7, - numsprites,m?MAXSPRITESV8:MAXSPRITESV7); + numsectors, m?MAXSECTORSV8:MAXSECTORSV7, + numwalls, m?MAXWALLSV8:MAXWALLSV7, + numsprites, m?MAXSPRITESV8:MAXSPRITESV7); i = 0; while ((snotbuf[i] != 0) && (i < 46)) @@ -5910,156 +5913,122 @@ void copysector(int16_t soursector, int16_t destsector, int16_t deststartwall, c } } +#define DOPRINT(Yofs, fmt, ...) \ + Bsprintf(snotbuf, fmt, ## __VA_ARGS__); \ + printext16(8+col*200, ydim/*-(row*96)*/-STATUS2DSIZ+Yofs, color, -1, snotbuf, 0); + void showsectordata(int16_t sectnum) { + sectortype *sec; char snotbuf[80]; - int32_t col = 1, row = 0; + int32_t col=0; //,row = 0; int32_t mode = (sectnum & 16384); int32_t color = mode?whitecol:editorcolors[11]; sectnum &= ~16384; + sec = §or[sectnum]; if (mode) { - _printmessage16("^10Sector %d %s ^O(F7 to edit)",sectnum, ExtGetSectorCaption(sectnum)); + _printmessage16("^10Sector %d %s ^O(F7 to edit)", sectnum, ExtGetSectorCaption(sectnum)); return; } - Bsprintf(snotbuf,"^10Sector %d",sectnum); - printext16(8,ydim-(row*96)-STATUS2DSIZ+32,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Firstwall: %d",sector[sectnum].wallptr); - printext16(8,ydim-(row*96)-STATUS2DSIZ+48,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Numberofwalls: %d",sector[sectnum].wallnum); - printext16(8,ydim-(row*96)-STATUS2DSIZ+56,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Firstsprite: %d",headspritesect[sectnum]); - printext16(8,ydim-(row*96)-STATUS2DSIZ+64,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Tags: %d, %d",sector[sectnum].hitag,sector[sectnum].lotag); - printext16(8,ydim-(row*96)-STATUS2DSIZ+72,color,-1,snotbuf,0); - Bsprintf(snotbuf," (0x%x), (0x%x)",sector[sectnum].hitag,sector[sectnum].lotag); - printext16(8,ydim-(row*96)-STATUS2DSIZ+80,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Extra: %d",sector[sectnum].extra); - printext16(8,ydim-(row*96)-STATUS2DSIZ+88,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Visibility: %d",sector[sectnum].visibility); - printext16(8,ydim-(row*96)-STATUS2DSIZ+96,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Pixel height: %d",(sector[sectnum].floorz-sector[sectnum].ceilingz)>>8); - printext16(8,ydim-(row*96)-STATUS2DSIZ+104,color,-1,snotbuf,0); + DOPRINT(32, "^10Sector %d", sectnum); + DOPRINT(48, "Firstwall: %d", sec->wallptr); + DOPRINT(56, "Numberofwalls: %d", sec->wallnum); + DOPRINT(64, "Firstsprite: %d", headspritesect[sectnum]); + DOPRINT(72, "Tags: %d, %d", sec->hitag, sec->lotag); + DOPRINT(80, " (0x%x), (0x%x)", sec->hitag, sec->lotag); + DOPRINT(88, "Extra: %d", sec->extra); + DOPRINT(96, "Visibility: %d", sec->visibility); + DOPRINT(104, "Pixel height: %d", (sec->floorz-sec->ceilingz)>>8); col++; - printext16(8+((col-1)*200),ydim-(row*96)-STATUS2DSIZ+32,color,-1,"^10CEILING:^O",0); - Bsprintf(snotbuf,"Flags (hex): %x",sector[sectnum].ceilingstat); - printext16(8+((col-1)*200),ydim-(row*96)-STATUS2DSIZ+48,color,-1,snotbuf,0); - Bsprintf(snotbuf,"(X,Y)pan: %d, %d",sector[sectnum].ceilingxpanning,sector[sectnum].ceilingypanning); - printext16(8+((col-1)*200),ydim-(row*96)-STATUS2DSIZ+56,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Shade byte: %d",sector[sectnum].ceilingshade); - printext16(8+((col-1)*200),ydim-(row*96)-STATUS2DSIZ+64,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Z-coordinate: %d",sector[sectnum].ceilingz); - printext16(8+((col-1)*200),ydim-(row*96)-STATUS2DSIZ+72,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Tile number: %d",sector[sectnum].ceilingpicnum); - printext16(8+((col-1)*200),ydim-(row*96)-STATUS2DSIZ+80,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Ceiling heinum: %d",sector[sectnum].ceilingheinum); - printext16(8+((col-1)*200),ydim-(row*96)-STATUS2DSIZ+88,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Palookup number: %d",sector[sectnum].ceilingpal); - printext16(8+((col-1)*200),ydim-(row*96)-STATUS2DSIZ+96,color,-1,snotbuf,0); + DOPRINT(32, "^10CEILING:^O"); + DOPRINT(48, "Flags (hex): %x", sec->ceilingstat); + DOPRINT(56, "(X, Y)pan: %d, %d", sec->ceilingxpanning, sec->ceilingypanning); + DOPRINT(64, "Shade byte: %d", sec->ceilingshade); + DOPRINT(72, "Z-coordinate: %d", sec->ceilingz); + DOPRINT(80, "Tile number: %d", sec->ceilingpicnum); + DOPRINT(88, "Ceiling heinum: %d", sec->ceilingheinum); + DOPRINT(96, "Palookup number: %d", sec->ceilingpal); col++; - printext16(8+((col-1)*200),ydim-STATUS2DSIZ+32,color,-1,"^10FLOOR:^O",0); - Bsprintf(snotbuf,"Flags (hex): %x",sector[sectnum].floorstat); - printext16(8+((col-1)*200),ydim-STATUS2DSIZ+48,color,-1,snotbuf,0); - Bsprintf(snotbuf,"(X,Y)pan: %d, %d",sector[sectnum].floorxpanning,sector[sectnum].floorypanning); - printext16(8+((col-1)*200),ydim-STATUS2DSIZ+56,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Shade byte: %d",sector[sectnum].floorshade); - printext16(8+((col-1)*200),ydim-STATUS2DSIZ+64,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Z-coordinate: %d",sector[sectnum].floorz); - printext16(8+((col-1)*200),ydim-STATUS2DSIZ+72,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Tile number: %d",sector[sectnum].floorpicnum); - printext16(8+((col-1)*200),ydim-STATUS2DSIZ+80,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Floor heinum: %d",sector[sectnum].floorheinum); - printext16(8+((col-1)*200),ydim-STATUS2DSIZ+88,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Palookup number: %d",sector[sectnum].floorpal); - printext16(8+((col-1)*200),ydim-STATUS2DSIZ+96,color,-1,snotbuf,0); + DOPRINT(32, "^10FLOOR:^O"); + DOPRINT(48, "Flags (hex): %x", sec->floorstat); + DOPRINT(56, "(X, Y)pan: %d, %d", sec->floorxpanning, sec->floorypanning); + DOPRINT(64, "Shade byte: %d", sec->floorshade); + DOPRINT(72, "Z-coordinate: %d", sec->floorz); + DOPRINT(80, "Tile number: %d", sec->floorpicnum); + DOPRINT(88, "Floor heinum: %d", sec->floorheinum); + DOPRINT(96, "Palookup number: %d", sec->floorpal); } void showwalldata(int16_t wallnum) { - int32_t dax; + walltype *wal; + int32_t sec; char snotbuf[80]; - int32_t col = 1, row = 0; + int32_t col=0; //, row = 0; int32_t mode = (wallnum & 16384); int32_t color = mode?whitecol:editorcolors[11]; wallnum &= ~16384; + wal = &wall[wallnum]; if (mode) { - _printmessage16("^10Wall %d %s ^O(F8 to edit)",wallnum, ExtGetWallCaption(wallnum)); + _printmessage16("^10Wall %d %s ^O(F8 to edit)", wallnum, ExtGetWallCaption(wallnum)); return; } - Bsprintf(snotbuf,"^10Wall %d",wallnum); - printext16(8,ydim-(row*80)-STATUS2DSIZ+32,color,-1,snotbuf,0); - Bsprintf(snotbuf,"X-coordinate: %d",wall[wallnum].x); - printext16(8,ydim-(row*80)-STATUS2DSIZ+48,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Y-coordinate: %d",wall[wallnum].y); - printext16(8,ydim-(row*80)-STATUS2DSIZ+56,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Point2: %d",wall[wallnum].point2); - printext16(8,ydim-(row*80)-STATUS2DSIZ+64,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Sector: ^010%d",sectorofwall(wallnum)); - printext16(8,ydim-(row*80)-STATUS2DSIZ+72,color,-1,snotbuf,0); + DOPRINT(32, "^10Wall %d", wallnum); + DOPRINT(48, "X-coordinate: %d", wal->x); + DOPRINT(56, "Y-coordinate: %d", wal->y); + DOPRINT(64, "Point2: %d", wal->point2); + DOPRINT(72, "Sector: ^010%d", sectorofwall(wallnum)); - Bsprintf(snotbuf,"Tags: %d, %d",wall[wallnum].hitag,wall[wallnum].lotag); - printext16(8,ydim-(row*80)-STATUS2DSIZ+88,color,-1,snotbuf,0); - Bsprintf(snotbuf," (0x%x), (0x%x)",wall[wallnum].hitag,wall[wallnum].lotag); - printext16(8,ydim-(row*80)-STATUS2DSIZ+96,color,-1,snotbuf,0); + DOPRINT(88, "Tags: %d, %d", wal->hitag, wal->lotag); + DOPRINT(96, " (0x%x), (0x%x)", wal->hitag, wal->lotag); col++; - Bsprintf(snotbuf,"^10%s^O",names[wall[wallnum].picnum]); - printext16(8+((col-1)*200),ydim-(row*80)-STATUS2DSIZ+32,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Flags (hex): %x",wall[wallnum].cstat); - printext16(8+((col-1)*200),ydim-(row*80)-STATUS2DSIZ+48,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Shade: %d",wall[wallnum].shade); - printext16(8+((col-1)*200),ydim-(row*80)-STATUS2DSIZ+56,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Pal: %d",wall[wallnum].pal); - printext16(8+((col-1)*200),ydim-(row*80)-STATUS2DSIZ+64,color,-1,snotbuf,0); - Bsprintf(snotbuf,"(X,Y)repeat: %d, %d",wall[wallnum].xrepeat,wall[wallnum].yrepeat); - printext16(8+((col-1)*200),ydim-(row*80)-STATUS2DSIZ+72,color,-1,snotbuf,0); - Bsprintf(snotbuf,"(X,Y)pan: %d, %d",wall[wallnum].xpanning,wall[wallnum].ypanning); - printext16(8+((col-1)*200),ydim-(row*80)-STATUS2DSIZ+80,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Tile number: %d",wall[wallnum].picnum); - printext16(8+((col-1)*200),ydim-(row*80)-STATUS2DSIZ+88,color,-1,snotbuf,0); - Bsprintf(snotbuf,"OverTile number: %d",wall[wallnum].overpicnum); - printext16(8+((col-1)*200),ydim-(row*80)-STATUS2DSIZ+96,color,-1,snotbuf,0); + DOPRINT(32, "^10%s^O", (wal->picnum>=0 && wal->picnumpicnum] : "!INVALID!"); + DOPRINT(48, "Flags (hex): %x", wal->cstat); + DOPRINT(56, "Shade: %d", wal->shade); + DOPRINT(64, "Pal: %d", wal->pal); + DOPRINT(72, "(X, Y)repeat: %d, %d", wal->xrepeat, wal->yrepeat); + DOPRINT(80, "(X, Y)pan: %d, %d", wal->xpanning, wal->ypanning); + DOPRINT(88, "Tile number: %d", wal->picnum); + DOPRINT(96, "OverTile number: %d", wal->overpicnum); col++; - Bsprintf(snotbuf,"nextsector: %d",wall[wallnum].nextsector); - printext16(8+((col-1)*200),ydim-STATUS2DSIZ+48-(mode?16:0),color,-1,snotbuf,0); - Bsprintf(snotbuf,"nextwall: %d",wall[wallnum].nextwall); - printext16(8+((col-1)*200),ydim-STATUS2DSIZ+56-(mode?16:0),color,-1,snotbuf,0); + DOPRINT(48-(mode?16:0), "nextsector: %d", wal->nextsector); + DOPRINT(56-(mode?16:0), "nextwall: %d", wal->nextwall); - Bsprintf(snotbuf,"Extra: %d",wall[wallnum].extra); - printext16(8+((col-1)*200),ydim-STATUS2DSIZ+72-(mode?16:0),color,-1,snotbuf,0); + DOPRINT(72-(mode?16:0), "Extra: %d", wal->extra); // TX 20050102 I'm not sure what unit dist<<4 is supposed to be, but dist itself is correct in terms of game coordinates as one would expect + DOPRINT(96-(mode?16:0), "Wall length: %d", wallength(wallnum)); - Bsprintf(snotbuf, "Wall length: %d", wallength(wallnum)); - printext16(8+((col-1)*200),ydim-STATUS2DSIZ+96-(mode?16:0),color,-1,snotbuf,0); - - dax = (int32_t)sectorofwall(wallnum); - Bsprintf(snotbuf,"Pixel height: %d",(sector[dax].floorz-sector[dax].ceilingz)>>8); - printext16(8+((col-1)*200),ydim-STATUS2DSIZ+104-(mode?16:0),color,-1,snotbuf,0); + sec = sectorofwall(wallnum); + DOPRINT(104-(mode?16:0), "Pixel height: %d", (sector[sec].floorz-sector[sec].ceilingz)>>8); } void showspritedata(int16_t spritenum) { + spritetype *spr; char snotbuf[80]; - int32_t col = 1, row = 0; + int32_t col=0; //, row = 0; int32_t mode = (spritenum & 16384); int32_t color = mode?whitecol:editorcolors[11]; spritenum &= ~16384; + spr = &sprite[spritenum]; if (mode) { @@ -6067,69 +6036,43 @@ void showspritedata(int16_t spritenum) return; } - Bsprintf(snotbuf,"^10Sprite %d",spritenum); - printext16(8,ydim-(row*80)-STATUS2DSIZ+32,color,-1,snotbuf,0); - Bsprintf(snotbuf,"X-coordinate: %d",sprite[spritenum].x); - printext16(8,ydim-(row*80)-STATUS2DSIZ+48,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Y-coordinate: %d",sprite[spritenum].y); - printext16(8,ydim-(row*80)-STATUS2DSIZ+56,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Z-coordinate: %d",sprite[spritenum].z); - printext16(8,ydim-(row*80)-STATUS2DSIZ+64,color,-1,snotbuf,0); + DOPRINT(32, "^10Sprite %d", spritenum); + DOPRINT(48, "X-coordinate: %d", spr->x); + DOPRINT(56, "Y-coordinate: %d", spr->y); + DOPRINT(64, "Z-coordinate: %d", spr->z); - Bsprintf(snotbuf,"Sectnum: ^010%d",sprite[spritenum].sectnum); - printext16(8,ydim-(row*80)-STATUS2DSIZ+72,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Statnum: %d",sprite[spritenum].statnum); - printext16(8,ydim-(row*80)-STATUS2DSIZ+80,color,-1,snotbuf,0); + DOPRINT(72, "Sectnum: ^010%d", spr->sectnum); + DOPRINT(80, "Statnum: %d", spr->statnum); - Bsprintf(snotbuf,"Tags: %d, %d",sprite[spritenum].hitag,sprite[spritenum].lotag); - printext16(8,ydim-(row*80)-STATUS2DSIZ+96,color,-1,snotbuf,0); - Bsprintf(snotbuf," (0x%x), (0x%x)",sprite[spritenum].hitag,sprite[spritenum].lotag); - printext16(8,ydim-(row*80)-STATUS2DSIZ+104,color,-1,snotbuf,0); + DOPRINT(96, "Tags: %d, %d", spr->hitag, spr->lotag); + DOPRINT(104, " (0x%x), (0x%x)", spr->hitag, spr->lotag); col++; - Bsprintf(snotbuf,"^10%s^O",names[sprite[spritenum].picnum]); - printext16(8+((col-1)*200),ydim-(row*72)-STATUS2DSIZ+32,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Flags (hex): %x",sprite[spritenum].cstat); - printext16(8+((col-1)*200),ydim-(row*72)-STATUS2DSIZ+48,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Shade: %d",sprite[spritenum].shade); - printext16(8+((col-1)*200),ydim-(row*72)-STATUS2DSIZ+56,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Pal: %d",sprite[spritenum].pal); - printext16(8+((col-1)*200),ydim-(row*72)-STATUS2DSIZ+64,color,-1,snotbuf,0); - Bsprintf(snotbuf,"(X,Y)repeat: %d, %d",sprite[spritenum].xrepeat,sprite[spritenum].yrepeat); - printext16(8+((col-1)*200),ydim-(row*72)-STATUS2DSIZ+72,color,-1,snotbuf,0); - Bsprintf(snotbuf,"(X,Y)offset: %d, %d",sprite[spritenum].xoffset,sprite[spritenum].yoffset); - printext16(8+((col-1)*200),ydim-(row*72)-STATUS2DSIZ+80,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Tile number: %d",sprite[spritenum].picnum); - printext16(8+((col-1)*200),ydim-(row*72)-STATUS2DSIZ+88,color,-1,snotbuf,0); + DOPRINT(32, "^10%s^O", (spr->picnum>=0 && spr->picnumpicnum] : "!INVALID!"); + DOPRINT(48, "Flags (hex): %x", spr->cstat); + DOPRINT(56, "Shade: %d", spr->shade); + DOPRINT(64, "Pal: %d", spr->pal); + DOPRINT(72, "(X, Y)repeat: %d, %d", spr->xrepeat, spr->yrepeat); + DOPRINT(80, "(X, Y)offset: %d, %d", spr->xoffset, spr->yoffset); + DOPRINT(88, "Tile number: %d", spr->picnum); col++; - Bsprintf(snotbuf,"Angle (2048 degrees): %d",sprite[spritenum].ang); - printext16(8+((col-1)*200),ydim-STATUS2DSIZ+48,color,-1,snotbuf,0); - Bsprintf(snotbuf,"X-Velocity: %d",sprite[spritenum].xvel); - printext16(8+((col-1)*200),ydim-STATUS2DSIZ+56,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Y-Velocity: %d",sprite[spritenum].yvel); - printext16(8+((col-1)*200),ydim-STATUS2DSIZ+64,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Z-Velocity: %d",sprite[spritenum].zvel); - printext16(8+((col-1)*200),ydim-STATUS2DSIZ+72,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Owner: %d",sprite[spritenum].owner); - printext16(8+((col-1)*200),ydim-STATUS2DSIZ+80,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Clipdist: %d",sprite[spritenum].clipdist); - printext16(8+((col-1)*200),ydim-STATUS2DSIZ+88,color,-1,snotbuf,0); - Bsprintf(snotbuf,"Extra: %d",sprite[spritenum].extra); - printext16(8+((col-1)*200),ydim-STATUS2DSIZ+96,color,-1,snotbuf,0); + DOPRINT(48, "Angle (2048 degrees): %d", spr->ang); + DOPRINT(56, "X-Velocity: %d", spr->xvel); + DOPRINT(64, "Y-Velocity: %d", spr->yvel); + DOPRINT(72, "Z-Velocity: %d", spr->zvel); + DOPRINT(80, "Owner: %d", spr->owner); + DOPRINT(88, "Clipdist: %d", spr->clipdist); + DOPRINT(96, "Extra: %d", spr->extra); } -// gets called once per totalclock increment since last call (at least in sdlayer.c) +#undef DOPRINT + +// gets called once per totalclock increment since last call void keytimerstuff(void) { -// static int32_t ltotalclock=0; -// int32_t fac=1; //(totalclock-ltotalclock); - -// if (fac==0) return; -// ltotalclock=totalclock; - if (DOWN_BK(STRAFE) == 0) { if (DOWN_BK(TURNLEFT)) angvel = max(angvel-pk_turnaccel, -128); @@ -6151,8 +6094,7 @@ void keytimerstuff(void) if (svel > 0) svel = max(svel-6, 0); if (vel < 0) vel = min(vel+6, 0); if (vel > 0) vel = max(vel-6, 0); - /* if(mlook) - pos.z -= (horiz-101)*(vel/40); */ + /* if(mlook) pos.z -= (horiz-101)*(vel/40); */ } int32_t snfillprintf(char *outbuf, size_t bufsiz, int32_t fill, const char *fmt, ...) @@ -6300,7 +6242,7 @@ static void AlignWalls(int32_t nWall0, int32_t z0, int32_t nWall1, int32_t z1, i z1 = GetWallZPeg(nWall1); - for (n=(picsiz[nTile]>>4); ((1<>4; (1<>(n+3))); @@ -6315,7 +6257,7 @@ void AutoAlignWalls(int32_t nWall0, int32_t ply) if (ply == 0) { //clear visited bits - memset(visited,0,sizeof(visited)); + Bmemset(visited,0,sizeof(visited)); visited[nWall0] = 1; } diff --git a/polymer/eduke32/build/src/osd.c b/polymer/eduke32/build/src/osd.c index 2ac24c220..f7d80e3ac 100644 --- a/polymer/eduke32/build/src/osd.c +++ b/polymer/eduke32/build/src/osd.c @@ -1370,8 +1370,8 @@ void OSD_Draw(void) clearbackground(osdcols,osdrowscur+1); - if (osdver[0]) - drawosdstr(osdcols-osdverlen,osdrowscur,osdver,osdverlen,(sintable[(totalclock<<4)&2047]>>11),osdverpal); + if (osdver[0] && osdrowscur>2) + drawosdstr(osdcols-osdverlen,osdrowscur-2,osdver,osdverlen,(sintable[(totalclock<<4)&2047]>>11),osdverpal); for (; lines>0; lines--, row--) { diff --git a/polymer/eduke32/m32script_ex.map b/polymer/eduke32/m32script_ex.map index 0a98c6c138da1a4539fc4889e6df8cc40689d491..babb2c9150bd6a8f1fa82bc7d82fa8fee30f23d3 100755 GIT binary patch literal 30498 zcmb82e{7c5b;pl?@FRW+keFZ+7`(#?c$fwUNK9fD(&+HvSEOT9^fN z6CR%t#_z-*;&>g*jK-tuX&mhXW=OCfT|XCxUI!S5GYj^k>uLP=0M#{R7N?(x%o{)4`FCr z{*=uh{dX76FpNj~oqwmJhr)O?f9Idc&=%c)TDZTC}NPq_Z4;9gjoIYZCh-I6e=)5XHAP9mo8g4+|?^ zpV`Op7FZVLZ`u8a0DcQrMEO4<*uNX+hu1g5@~D2IahKn%SRtW*MfvaQV<9}8-JknI zn4j181)O0$-m2pK@&5OthiIIyFPlI5XAye1()HfIZLlQj58?jU*0cWd08EecNA=_C zYXPo!q5h)&MAu_~Spt)@>skN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bw-H>{5kf7W4V3{rCFbCUv(_kFJNnRmWT%KdBFBMmTL#F z=N-$r0PKuoam+UBjLMU@#P>Pc>WGM7VksX9gE}8pz}9ReC@f0uy`N3_7HxHI#b0j?&Ds^;`m;6EdD${ z<5*nlZ|VFMy?D?1#Id;6?>ZLuW{1vH(J%<>_qb!RhAWQ6IW9XE_q?4wMK3;k+OuMr z)va)CHdA-~H_U3hwq~7YdDtV4#XaFg5?nC)>a{@M7jW9OI;j>WZJ)OjX) zU)Nk@KL;OlES{62j>UPq;aJ@B4LbWoFYcip$KqPI=TYJp*ZQRMi)&}M&dEIWaL%!~ zhi*6)udP{UpJ>4GwRby&#b=F=oL`({J6DTe{F%(&aS;~#wa@;-;=SdL&R=119C~#2 z^&x7@y{getSl_9bvr8yy8+HrJ1Yx|``Bi+uq&b8A)S-*GeGS3oMZ9q zyXIJ)soQ^oITr5$_N*dL%4r)ybi*tO*vABNkI1P9|?$X&O z8n(jPIpJ9Bx9IfZ9A9;Q@!6>CSbYBN*ZC`J!!di;vAE7A9EHSlq`qUEW@T_0X>KO!VS7*z;duabMVT0%7rU`zfaZ$JcsZ{BDD5vv;(F z#c{BAzl6ncuy@LY#c{A_#lqsXb?clI7Wd|`V{xrtb}XKg_TH6fz0; i++,col--) - clearbufbyte((char *)(frameplace + i*bytesperline), bytesperline, - (col<<24)|(col<<16)|(col<<8)|col); - clearbufbyte((char *)(frameplace + i*bytesperline), (ydim-i)*bytesperline, 0); + CLEARLINES2D(i, 1, (col<<24)|(col<<16)|(col<<8)|col); + CLEARLINES2D(i, ydim-i, 0); enddrawing(); } @@ -1022,8 +1021,8 @@ void ExtShowSectorData(int16_t sectnum) //F5 printmessage16("Level %s",levelname); #define PRSTAT(Str, Tiledef) \ - PrintStatus(Str, numsprite[Tiledef], x, y+yi, 11); \ - PrintStatus("",multisprite[Tiledef], x2,y+yi, 9); \ + PrintStatus(Str, numsprite[Tiledef], x, y+yi, numsprite[Tiledef]?11:7); \ + PrintStatus("",multisprite[Tiledef], x2,y+yi, multisprite[Tiledef]?9:7); \ yi++; ydim -= 8; // vvvvvv reset at end!! @@ -1162,7 +1161,7 @@ void ExtShowWallData(int16_t wallnum) //F6 clearmidstatbar16(); drawgradient(); - printmessage16("Level %s next tag %d",levelname,nextfreetag); + printmessage16("Level %s next tag %d", levelname, nextfreetag); #define CASES_LIZTROOP \ @@ -1254,9 +1253,9 @@ void ExtShowWallData(int16_t wallnum) //F6 x=2+runi*34; y=4; - PrintStatus(runi==0?"Normal Actors =":"Respawn", total,x,y,11); + PrintStatus(runi==0?"Normal actors:":"Respawn actors:", total, x, y, 11); -#define PRSTAT(Str, Tiledef) PrintStatus(Str, numsprite[Tiledef], x, y+(yi++), 11); +#define PRSTAT(Str, Tiledef) PrintStatus(Str, numsprite[Tiledef], x, y+(yi++), numsprite[Tiledef]?11:7); yi=1; PRSTAT(" Liztroop =", LIZTROOP); @@ -1273,7 +1272,7 @@ void ExtShowWallData(int16_t wallnum) //F6 yi=1; PRSTAT("Slimer =", GREENSLIME); PRSTAT("Boss1 =", BOSS1); - PrintStatus("MiniBoss1 =",multisprite[BOSS1], x, y+(yi++), 11); + PrintStatus("MiniBoss1 =", multisprite[BOSS1], x, y+(yi++), multisprite[BOSS1]?11:7); PRSTAT("Boss2 =", BOSS2); PRSTAT("Boss3 =", BOSS3); PRSTAT("Riot Tank =", TANK); @@ -1478,7 +1477,7 @@ HELPFILE_ERROR: // why can't MSVC allocate an array of variable size?! #define IHELP_NUMDISPLINES 110 // ((overridepm16y>>4)+(overridepm16y>>5)+(overridepm16y>>7)-2) #define IHELP_PATLEN 45 -extern int32_t overridepm16y; // influences printmessage16() and clearmidstatbar16() +extern int32_t overridepm16y; // influences clearmidstatbar16() static void IntegratedHelp() { @@ -1493,18 +1492,15 @@ static void IntegratedHelp() char disptext[IHELP_NUMDISPLINES][80]; char oldpattern[IHELP_PATLEN+1]; - drawgradient(); - - begindrawing(); - printext16(9, ydim2d-overridepm16y+9, editorcolors[4], -1, "Help Mode", 0); - printext16(8, ydim2d-overridepm16y+8, editorcolors[12], -1, "Help Mode", 0); - enddrawing(); - - memset(oldpattern, 0, sizeof(char)); + Bmemset(oldpattern, 0, sizeof(char)); // clearmidstatbar16(); while (keystatus[KEYSC_ESC]==0 && keystatus[KEYSC_Q]==0 && keystatus[KEYSC_F1]==0) { + begindrawing(); + CLEARLINES2D(0, ydim, 0); + enddrawing(); + idle_waitevent(); if (handleevents()) quitevent = 0; @@ -1604,10 +1600,9 @@ static void IntegratedHelp() showframe(1); idle_waitevent(); + if (handleevents()) - { - if (quitevent) quitevent = 0; - } + quitevent = 0; ch = bgetchar(); @@ -1673,11 +1668,12 @@ ENDFOR1: } } - drawgradient(); +// drawgradient(); begindrawing(); printext16(9, ydim2d-overridepm16y+9, editorcolors[4], -1, "Help Mode", 0); printext16(8, ydim2d-overridepm16y+8, editorcolors[12], -1, "Help Mode", 0); + printext16(8 + 9*8 + 2*8, ydim2d-overridepm16y+8, editorcolors[15], -1, "(S:search)", 0); enddrawing(); if (curhp < helppage[0]->numlines) @@ -1688,12 +1684,14 @@ ENDFOR1: for (i=0; j=(curhp==0)?(i+curline+1):(i+curline), inumlines; i++) { - if (ydim-overridepm16y+28+i*9+32 >= ydim) break; + if (ydim-overridepm16y+28+i*9+32 >= ydim) + break; Bmemcpy(disptext[i], helppage[curhp]->line[j], 80); - printext16(8,ydim-overridepm16y+28+i*9,editorcolors[10], + printext16(8, ydim-overridepm16y+28+i*9, editorcolors[10], (j==highlightline && curhp==highlighthp - && totalclock-lasthighlighttime<120*5)?editorcolors[1]:-1, - disptext[i],0); + && totalclock-lasthighlighttime<120*5) ? + editorcolors[1] : -1, + disptext[i], 0); } showframe(1); @@ -1865,15 +1863,20 @@ static void SoundDisplay() while (keystatus[KEYSC_ESC]==0 && keystatus[KEYSC_Q]==0 && keystatus[KEYSC_F2]==0 && keystatus[buildkeys[BK_MODE2D_3D]]==0) // quickjump to 3d mode { + begindrawing(); + CLEARLINES2D(0, ydim16, 0); + enddrawing(); + idle_waitevent(); if (handleevents()) quitevent = 0; - drawgradient(); +// drawgradient(); begindrawing(); printext16(9, ydim2d-overridepm16y+9, editorcolors[4], -1, "Sound Index", 0); printext16(8, ydim2d-overridepm16y+8, editorcolors[12], -1, "Sound Index", 0); + printext16(8 + 11*8 + 2*8, ydim2d-overridepm16y+8, editorcolors[15], -1, "(SPACE:play, S:sort)", 0); enddrawing(); if (PRESSED_KEYSC(G)) // goto specified sound# @@ -1956,14 +1959,12 @@ static void SoundDisplay() bflushchars(); while (bad == 0) { - _printmessage16("Sort by: (S)num (D)ef (F)ile ori(g) or (12345)"); + _printmessage16("Sort by: (S)oundnum (D)ef (F)ile ori(g) or flags (12345)"); showframe(1); idle_waitevent(); if (handleevents()) - { - if (quitevent) quitevent = 0; - } + quitevent = 0; ch = bgetchar(); @@ -2621,6 +2622,8 @@ static int32_t AskIfSure(char *text) while ((keystatus[KEYSC_ESC]|keystatus[KEYSC_ENTER]|keystatus[KEYSC_SPACE]|keystatus[KEYSC_N]) == 0) { + idle_waitevent(); + if (handleevents()) { if (quitevent) @@ -2629,7 +2632,6 @@ static int32_t AskIfSure(char *text) break; } } - idle(); if (PRESSED_KEYSC(Y) || PRESSED_KEYSC(ENTER)) { @@ -2638,11 +2640,8 @@ static int32_t AskIfSure(char *text) } } - while (PRESSED_KEYSC(ESC)) - { + if (PRESSED_KEYSC(ESC)) retval = 1; - break; - } return(retval); } @@ -2682,7 +2681,7 @@ static int32_t DrawTiles(int32_t iTopLeft, int32_t iSelected, int32_t nXTiles, i static int32_t m32gettile(int32_t idInitialTile) { - int32_t gap, temp; + int32_t gap, temp, zoomsz; int32_t nXTiles, nYTiles, nDisplayedTiles; int32_t i; int32_t iTile, iTopLeftTile; @@ -2822,8 +2821,10 @@ static int32_t m32gettile(int32_t idInitialTile) iTopLeftTile = iTile - (iTile % nXTiles); iTopLeftTile = clamp(iTopLeftTile, 0, MAXTILES-nDisplayedTiles); - searchx = ((iTile-iTopLeftTile)%nXTiles)*ZoomToThumbSize[s_Zoom] + ZoomToThumbSize[s_Zoom]/2; - searchy = ((iTile-iTopLeftTile)/nXTiles)*ZoomToThumbSize[s_Zoom] + ZoomToThumbSize[s_Zoom]/2; + zoomsz = ZoomToThumbSize[s_Zoom]; + + searchx = ((iTile-iTopLeftTile)%nXTiles)*zoomsz + zoomsz/2; + searchy = ((iTile-iTopLeftTile)/nXTiles)*zoomsz + zoomsz/2; //////////////////////////////// // Start of key handling code // @@ -2831,8 +2832,21 @@ static int32_t m32gettile(int32_t idInitialTile) while ((keystatus[KEYSC_ENTER]|keystatus[KEYSC_ESC]|(bstatus&1)) == 0) // <- Presumably one of these is escape key ?? { + zoomsz = ZoomToThumbSize[s_Zoom]; + DrawTiles(iTopLeftTile, (iTile >= localartlookupnum) ? localartlookupnum-1 : iTile, - nXTiles, nYTiles, ZoomToThumbSize[s_Zoom], moffset); + nXTiles, nYTiles, zoomsz, moffset); + + + idle_waitevent_timeout(500); + // SDL seems to miss mousewheel events when rotated slowly. + // These kludgy things seem to make it better, but I'm not sure. + idle(); + idle(); + + if (handleevents()) + quitevent = 0; + getmousevalues(&mousedx,&mousedy,&bstatus); searchx += mousedx; @@ -2850,52 +2864,43 @@ static int32_t m32gettile(int32_t idInitialTile) moffset=0; searchy -= mousedy*2; } - while (moffset>ZoomToThumbSize[s_Zoom]) + + while (moffset > zoomsz) { - iTopLeftTile-=nXTiles; - moffset-=ZoomToThumbSize[s_Zoom]; + iTopLeftTile -= nXTiles; + moffset -= zoomsz; } - while (moffset<-ZoomToThumbSize[s_Zoom]) + while (moffset < -zoomsz) { - iTopLeftTile+=nXTiles; - moffset+=ZoomToThumbSize[s_Zoom]; + iTopLeftTile += nXTiles; + moffset += zoomsz; } } // Keep the pointer visible at all times. - temp = min((ZoomToThumbSize[s_Zoom] / 2), 12); - if (searchx < temp) searchx = temp; - if (searchy < temp) searchy = temp; - if (searchx > xdim - temp) searchx = xdim - temp; - if (searchy > ydim - temp) searchy = ydim - temp; + temp = min(zoomsz/2, 12); + searchx = clamp(searchx, temp, xdim-temp); + searchy = clamp(searchy, temp, ydim-temp); - scrollmode=!(eitherCTRL^revertCTRL); + scrollmode = !(eitherCTRL^revertCTRL); if (bstatus&16 && scrollmode && iTopLeftTile > 0) { mouseb &= ~16; iTopLeftTile -= (nXTiles*scrollamount); } - if (bstatus&32 && scrollmode && iTopLeftTile < localartlookupnum-nDisplayedTiles-1) + else if (bstatus&32 && scrollmode && iTopLeftTile < localartlookupnum-nDisplayedTiles-1) { mouseb &= ~32; iTopLeftTile += (nXTiles*scrollamount); } - mtile=iTile=(searchx/ZoomToThumbSize[s_Zoom])+((searchy-moffset)/ZoomToThumbSize[s_Zoom])*nXTiles+iTopLeftTile; + mtile = iTile = searchx/zoomsz + ((searchy-moffset)/zoomsz)*nXTiles + iTopLeftTile; while (iTile >= iTopLeftTile + nDisplayedTiles) { - iTile-=nXTiles; - mtile=iTile; + iTile -= nXTiles; + mtile = iTile; } - if (bpp==8) // no idea why, but it breaks the mousewheel else :/ - idle_waitevent(); - else - idle(); - - if (handleevents()) - quitevent = 0; - // These two lines are so obvious I don't need to comment them ...;-) synctics = totalclock-lockclock; lockclock += synctics; @@ -2925,13 +2930,17 @@ static int32_t m32gettile(int32_t idInitialTile) s_Zoom--; } - if (iTile >= localartlookupnum)iTile = localartlookupnum-1; + zoomsz = ZoomToThumbSize[s_Zoom]; + + if (iTile >= localartlookupnum) + iTile = localartlookupnum-1; // Calculate new num of tiles to display - nXTiles = xdim / ZoomToThumbSize[s_Zoom]; - nYTiles = ydim / ZoomToThumbSize[s_Zoom]; + nXTiles = xdim / zoomsz; + nYTiles = ydim / zoomsz; // Refuse to draw less than half of a row. - if (ZoomToThumbSize[s_Zoom]/2 < 12) nYTiles--; + if (zoomsz/2 < 12) + nYTiles--; nDisplayedTiles = nXTiles * nYTiles; // Determine if the top-left displayed tile needs to @@ -2940,8 +2949,7 @@ static int32_t m32gettile(int32_t idInitialTile) iTopLeftTile = clamp(iTopLeftTile, 0, MAXTILES - nDisplayedTiles); // scroll window so mouse points the same tile as it was before zooming - iTopLeftTile -= (searchx/ZoomToThumbSize[s_Zoom]) + ((searchy-moffset)/ZoomToThumbSize[s_Zoom])*nXTiles - + iTopLeftTile-iTile; + iTopLeftTile -= searchx/zoomsz + ((searchy-moffset)/zoomsz)*nXTiles + iTopLeftTile-iTile; } if (PRESSED_KEYSC(LEFT)) @@ -3041,8 +3049,8 @@ static int32_t m32gettile(int32_t idInitialTile) } if (mtile!=iTile) // if changed by keyboard, update mouse cursor { - searchx=((iTile-iTopLeftTile)%nXTiles)*ZoomToThumbSize[s_Zoom]+ZoomToThumbSize[s_Zoom]/2; - searchy=((iTile-iTopLeftTile)/nXTiles)*ZoomToThumbSize[s_Zoom]+ZoomToThumbSize[s_Zoom]/2+moffset; + searchx = ((iTile-iTopLeftTile)%nXTiles) * zoomsz + zoomsz/2; + searchy = ((iTile-iTopLeftTile)/nXTiles) * zoomsz + zoomsz/2 + moffset; } } @@ -4302,7 +4310,7 @@ static void Keys3d(void) { if (AIMING_AT_SPRITE) { - sprite[searchwall].ang += tsign<<(eitherSHIFT*7); + sprite[searchwall].ang += tsign<<(!eitherSHIFT*7); sprite[searchwall].ang &= 2047; message("Sprite %d angle: %d", searchwall, sprite[searchwall].ang); } @@ -4969,11 +4977,11 @@ static void Keys3d(void) tempbuf[0] = 0; - if (bstatus&4 && !(bstatus&(1|2)) && !unrealedlook) //PK + if ((bstatus&(4|2|1))==4 && !unrealedlook) //PK Bsprintf(tempbuf,"VIEW"); - else if (bstatus&2 && !(bstatus&1)) - Bsprintf(tempbuf,"Z"); - else if (bstatus&1 && !(bstatus&2)) + else if ((bstatus&(2|1))==2) + Bsprintf(tempbuf,"Z%s", keystatus[KEYSC_HOME]?" 256":keystatus[KEYSC_END]?" 512":""); + else if ((bstatus&(2|1))==1) Bsprintf(tempbuf,"LOCK"); if (bstatus&1) @@ -6377,7 +6385,10 @@ static void Keys2d(void) if (keystatus[KEYSC_TAB]) //TAB { if (cursectornum >= 0) + { + drawgradient(); showsectordata((int16_t)i); + } } else if (!(keystatus[KEYSC_F5]|keystatus[KEYSC_F6]|keystatus[KEYSC_F7]|keystatus[KEYSC_F8])) { @@ -6498,7 +6509,7 @@ static void Keys2d(void) cursprite = ppointhighlight&16383; } - if (PRESSED_KEYSC(F9)) // F9 f1=3b + if (keystatus[KEYSC_F9]) // F9 f1=3b Show2dText("sthelp.hlp"); /* start Mapster32 */ @@ -6627,7 +6638,7 @@ static void Keys2d(void) i &= ~48; sprite[cursprite].cstat = i; - message("Sprite %d now view aligned", cursprite, aligntype[(i&48)/16]); + message("Sprite %d now %s aligned", cursprite, aligntype[(i&48)/16]); asksave = 1; } } diff --git a/polymer/eduke32/source/m32exec.c b/polymer/eduke32/source/m32exec.c index 2a6adf2c3..80254bd91 100644 --- a/polymer/eduke32/source/m32exec.c +++ b/polymer/eduke32/source/m32exec.c @@ -834,9 +834,9 @@ skip_check: insptr++; { int32_t bits=Gv_GetVarX(*insptr), scale=*(insptr+1); - double fval=(double)(*((float*)&bits)); + float fval = *((float*)&bits); - Gv_SetVarX(*insptr, (int32_t)((fval/scale)*2e9)); + Gv_SetVarX(*insptr, (int32_t)(fval * scale)); } insptr += 2; continue; @@ -845,7 +845,7 @@ skip_check: insptr++; { int32_t scaled=Gv_GetVarX(*insptr), scale=*(insptr+1); - float fval = (float)((((double)scaled)*scale)/2e9); + float fval = (float)scaled/(float)scale; Gv_SetVarX(*insptr, *((int32_t *)&fval)); } @@ -2281,6 +2281,20 @@ badindex: } break; + case 'f': + { + char buf[64]; + int32_t ii = 0; + + Bsprintf(buf, "%f", *((float *)&arg[i++])); + + ii = Bstrlen(buf); + Bmemcpy(&tmpbuf[j], buf, ii); + j += ii; + k++; + } + break; + case 's': { if (arg[i]>=0 && arg[i]