more polymer-override variable twiddling in m32script, fixes and beautifying.

git-svn-id: https://svn.eduke32.com/eduke32@1648 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2010-05-22 14:04:47 +00:00
parent 8120821f8d
commit 30877e925a
8 changed files with 540 additions and 320 deletions

View File

@ -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
ife searchstat 3 nullop else
{
ifhitkey KEY_gSLASH
{
ife pr_overrideparallax 0
{
set pr_overrideparallax 1
set pr_overridespecular 1
quote 28
}
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
set pr_overrideparallax 0
set pr_overridespecular 0
quote 27
}
}
}
ifn j 0
// if aiming at sector or wall
ife searchstat 3 nullop
else ifn pr_overrideparallax 0
{
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
// 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
{

View File

@ -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

View File

@ -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(&sector[numsectors],sizeof(sectortype),0L);
memset(&sector[numsectors],0,sizeof(sectortype));
Bmemset(&sector[numsectors],0,sizeof(sectortype));
sector[numsectors].extra = -1;
sector[numsectors].wallptr = numwalls;
@ -3338,7 +3339,7 @@ SKIP:
flipwalls(numwalls,newnumwalls);
//clearbufbyte(&sector[numsectors],sizeof(sectortype),0L);
memset(&sector[numsectors],0,sizeof(sectortype));
Bmemset(&sector[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<ydim; i++)
{
// drawline256(0, i<<12, xdim<<12, i<<12, col);
clearbufbyte((char *)(frameplace + (i*bytesperline)), (bytesperline), ((int32_t)col<<24)|((int32_t)col<<16)|((int32_t)col<<8)|col);
CLEARLINES2D(i, 1, (col<<24)|(col<<16)|(col<<8)|col);
col--;
if (col <= 0) break;
}
clearbufbyte((char *)(frameplace + (i*bytesperline)), (ydim-i)*(bytesperline), 0);
CLEARLINES2D(i, ydim-i, 0);
Bsprintf(tempbuf, "Mapster32" VERSION);
printext16(xdim2d-(Bstrlen(tempbuf)<<3)-3,ydim2d-STATUS2DSIZ2+10L, editorcolors[4],-1,tempbuf,0);
printext16(xdim2d-(Bstrlen(tempbuf)<<3)-2,ydim2d-STATUS2DSIZ2+9L, editorcolors[12],-1,tempbuf,0);
printext16(xdim2d-(Bstrlen(tempbuf)<<3)-3, ydim2d-STATUS2DSIZ2+10, editorcolors[4],-1, tempbuf, 0);
printext16(xdim2d-(Bstrlen(tempbuf)<<3)-2, ydim2d-STATUS2DSIZ2+9, editorcolors[12],-1, tempbuf, 0);
enddrawing();
}
@ -5317,7 +5319,8 @@ static int32_t menuselect(void)
do
{
begindrawing();
clearbuf((char *)frameplace, (bytesperline*ydim16) >> 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; ((i<listsize) && dir); i++, dir=dir->next)
{
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");
@ -5910,14 +5913,20 @@ 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 = &sector[sectnum];
if (mode)
{
@ -5925,71 +5934,50 @@ void showsectordata(int16_t 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)
{
@ -5997,69 +5985,50 @@ void showwalldata(int16_t 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->picnum<MAXTILES) ? names[wal->picnum] : "!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->picnum<MAXTILES) ? names[spr->picnum] : "!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<<n)<tilesizy[nTile]); n++);
for (n=picsiz[nTile]>>4; (1<<n)<tilesizy[nTile]; n++);
wall[nWall1].yrepeat = wall[nWall0].yrepeat;
wall[nWall1].ypanning = (uint8_t)(wall[nWall0].ypanning+(((z1-z0)*wall[nWall0].yrepeat)>>(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;
}

View File

@ -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--)
{

Binary file not shown.

View File

@ -205,9 +205,8 @@ static void drawgradient()
int32_t i, col = whitecol-21;
begindrawing();
for (i=ydim-STATUS2DSIZ+16; i<ydim && col>0; 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!!
@ -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,11 +1684,13 @@ ENDFOR1:
for (i=0; j=(curhp==0)?(i+curline+1):(i+curline),
i<IHELP_NUMDISPLINES && j<helppage[curhp]->numlines; 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],
(j==highlightline && curhp==highlighthp
&& totalclock-lasthighlighttime<120*5)?editorcolors[1]:-1,
&& totalclock-lasthighlighttime<120*5) ?
editorcolors[1] : -1,
disptext[i], 0);
}
@ -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,24 +2864,23 @@ 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];
moffset -= zoomsz;
}
while (moffset<-ZoomToThumbSize[s_Zoom])
while (moffset < -zoomsz)
{
iTopLeftTile += nXTiles;
moffset+=ZoomToThumbSize[s_Zoom];
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);
if (bstatus&16 && scrollmode && iTopLeftTile > 0)
@ -2875,27 +2888,19 @@ static int32_t m32gettile(int32_t idInitialTile)
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;
}
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,8 +6385,11 @@ 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]))
{
static int32_t counter = 0;
@ -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;
}
}

View File

@ -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]<MAXQUOTES && ScriptQuotes[arg[i]])

View File

@ -78,7 +78,7 @@ int32_t S_SoundStartup(void)
#if defined(_WIN32)
MixRate = 44100;
#else
MixRate = 48000;
MixRate = 44100;
#endif
fxdevicetype = ASS_AutoDetect;