Misc cleanups

git-svn-id: https://svn.eduke32.com/eduke32@232 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-07-21 22:25:05 +00:00
parent c4cd9ca1ef
commit d33bcb97a8
2 changed files with 484 additions and 591 deletions

View file

@ -4890,7 +4890,7 @@ void EditSpriteData(short spritenum)
{ {
char disptext[80]; char disptext[80];
char edittext[80]; char edittext[80];
char col=0, row=0, rowmax=2, dispwidth = 24; char col=0, row=0, rowmax=4, dispwidth = 24;
long xpos = 8, ypos = ydim-STATUS2DSIZ+48; long xpos = 8, ypos = ydim-STATUS2DSIZ+48;
int i = -1; int i = -1;
char editval = 0; char editval = 0;
@ -4925,7 +4925,20 @@ void EditSpriteData(short spritenum)
} }
if (keystatus[0xcb] > 0) if (keystatus[0xcb] > 0)
{ {
if (col == 2) switch (col)
{
case 1:
{
printext16(xpos,ypos+row*8,11,0,disptext,0);
col = 0;
xpos = 8;
rowmax = 4;
dispwidth = 23;
disptext[dispwidth] = 0;
if (row > rowmax) row = rowmax;
}
break;
case 2:
{ {
printext16(xpos,ypos+row*8,11,0,disptext,0); printext16(xpos,ypos+row*8,11,0,disptext,0);
col = 1; col = 1;
@ -4935,21 +4948,15 @@ void EditSpriteData(short spritenum)
disptext[dispwidth] = 0; disptext[dispwidth] = 0;
if (row > rowmax) row = rowmax; if (row > rowmax) row = rowmax;
} }
else if (col == 1) break;
{
printext16(xpos,ypos+row*8,11,0,disptext,0);
col = 0;
xpos = 8;
rowmax = 2;
dispwidth = 23;
disptext[dispwidth] = 0;
if (row > rowmax) row = rowmax;
} }
keystatus[0xcb] = 0; keystatus[0xcb] = 0;
} }
if (keystatus[0xcd] > 0) if (keystatus[0xcd] > 0)
{ {
if (col == 0) switch (col)
{
case 0:
{ {
printext16(xpos,ypos+row*8,11,0,disptext,0); printext16(xpos,ypos+row*8,11,0,disptext,0);
col = 1; col = 1;
@ -4959,7 +4966,8 @@ void EditSpriteData(short spritenum)
disptext[dispwidth] = 0; disptext[dispwidth] = 0;
if (row > rowmax) row = rowmax; if (row > rowmax) row = rowmax;
} }
else if (col == 1) break;
case 1:
{ {
printext16(xpos,ypos+row*8,11,0,disptext,0); printext16(xpos,ypos+row*8,11,0,disptext,0);
col = 2; col = 2;
@ -4969,6 +4977,8 @@ void EditSpriteData(short spritenum)
disptext[dispwidth] = 0; disptext[dispwidth] = 0;
if (row > rowmax) row = rowmax; if (row > rowmax) row = rowmax;
} }
break;
}
keystatus[0xcd] = 0; keystatus[0xcd] = 0;
} }
if (keystatus[0x1c] > 0) if (keystatus[0x1c] > 0)
@ -4976,10 +4986,13 @@ void EditSpriteData(short spritenum)
keystatus[0x1c] = 0; keystatus[0x1c] = 0;
editval = 1; editval = 1;
} }
switch (col)
{
case 0:
{
switch (row) switch (row)
{ {
case 0: case 0:
if (col == 0)
{ {
for (i=Bsprintf(disptext,"X-coordinate: %ld",sprite[spritenum].x); i < dispwidth; i++) disptext[i] = ' '; for (i=Bsprintf(disptext,"X-coordinate: %ld",sprite[spritenum].x); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) X-coordinate: ",spritenum); Bsprintf(edittext,"Sprite (%d) X-coordinate: ",spritenum);
@ -4989,29 +5002,8 @@ void EditSpriteData(short spritenum)
sprite[spritenum].x = getnumber16(edittext,sprite[spritenum].x,131072,1); sprite[spritenum].x = getnumber16(edittext,sprite[spritenum].x,131072,1);
} }
} }
else if (col == 1)
{
for (i=Bsprintf(disptext,"Flags (hex): %x",sprite[spritenum].cstat); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) Flags: ",spritenum);
if (editval)
{
printmessage16(edittext);
sprite[spritenum].cstat = (short)getnumber16(edittext,(long)sprite[spritenum].cstat,32768L,0);
}
}
else if (col == 2)
{
for (i=Bsprintf(disptext,"Angle (2048 degrees): %d",sprite[spritenum].ang); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) Angle: ",spritenum);
if (editval)
{
printmessage16(edittext);
sprite[spritenum].ang = (short)getnumber16(edittext,(long)sprite[spritenum].ang,2048L,0);
}
}
break; break;
case 1: case 1:
if (col == 0)
{ {
for (i=Bsprintf(disptext,"Y-coordinate: %ld",sprite[spritenum].y); i < dispwidth; i++) disptext[i] = ' '; for (i=Bsprintf(disptext,"Y-coordinate: %ld",sprite[spritenum].y); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) Y-coordinate: ",spritenum); Bsprintf(edittext,"Sprite (%d) Y-coordinate: ",spritenum);
@ -5021,29 +5013,8 @@ void EditSpriteData(short spritenum)
sprite[spritenum].y = getnumber16(edittext,sprite[spritenum].y,131072,1); sprite[spritenum].y = getnumber16(edittext,sprite[spritenum].y,131072,1);
} }
} }
else if (col == 1)
{
for (i=Bsprintf(disptext,"Shade: %d",sprite[spritenum].shade); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) Shade: ",spritenum);
if (editval)
{
printmessage16(edittext);
sprite[spritenum].shade = (char)getnumber16(edittext,(long)sprite[spritenum].shade,127,1);
}
}
else if (col == 2)
{
for (i=Bsprintf(disptext,"X-Velocity: %d",sprite[spritenum].xvel); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) X-Velocity: ",spritenum);
if (editval)
{
printmessage16(edittext);
sprite[spritenum].xvel = getnumber16(edittext,(long)sprite[spritenum].xvel,32767,1);
}
}
break; break;
case 2: case 2:
if (col == 0)
{ {
for (i=Bsprintf(disptext,"Z-coordinate: %ld",sprite[spritenum].z); i < dispwidth; i++) disptext[i] = ' '; for (i=Bsprintf(disptext,"Z-coordinate: %ld",sprite[spritenum].z); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) Z-coordinate: ",spritenum); Bsprintf(edittext,"Sprite (%d) Z-coordinate: ",spritenum);
@ -5053,7 +5024,63 @@ void EditSpriteData(short spritenum)
sprite[spritenum].z = getnumber16(edittext,sprite[spritenum].z,8388608,1); //2147483647L,-2147483648L sprite[spritenum].z = getnumber16(edittext,sprite[spritenum].z,8388608,1); //2147483647L,-2147483648L
} }
} }
else if (col == 1) break;
case 3:
{
for (i=Bsprintf(disptext,"Sectnum: %d",sprite[spritenum].sectnum); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) Sectnum: ",spritenum);
if (editval)
{
printmessage16(edittext);
i = getnumber16(edittext,sprite[spritenum].sectnum,MAXSECTORS-1,0);
if(i != sprite[spritenum].sectnum)
changespritesect(spritenum,i);
}
}
break;
case 4:
{
for (i=Bsprintf(disptext,"Statnum: %d",sprite[spritenum].statnum); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) Statnum: ",spritenum);
if (editval)
{
printmessage16(edittext);
i = getnumber16(edittext,sprite[spritenum].statnum,MAXSTATUS-1,0);
if(i != sprite[spritenum].statnum)
changespritestat(spritenum,i);
}
}
break;
}
}
break;
case 1:
{
switch (row)
{
case 0:
{
for (i=Bsprintf(disptext,"Flags (hex): %x",sprite[spritenum].cstat); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) Flags: ",spritenum);
if (editval)
{
printmessage16(edittext);
sprite[spritenum].cstat = (short)getnumber16(edittext,(long)sprite[spritenum].cstat,32768L,0);
}
}
break;
case 1:
{
for (i=Bsprintf(disptext,"Shade: %d",sprite[spritenum].shade); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) Shade: ",spritenum);
if (editval)
{
printmessage16(edittext);
sprite[spritenum].shade = (char)getnumber16(edittext,(long)sprite[spritenum].shade,127,1);
}
}
break;
case 2:
{ {
for (i=Bsprintf(disptext,"Pal: %d",sprite[spritenum].pal); i < dispwidth; i++) disptext[i] = ' '; for (i=Bsprintf(disptext,"Pal: %d",sprite[spritenum].pal); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) Pal: ",spritenum); Bsprintf(edittext,"Sprite (%d) Pal: ",spritenum);
@ -5063,20 +5090,8 @@ void EditSpriteData(short spritenum)
sprite[spritenum].pal = (char)getnumber16(edittext,(long)sprite[spritenum].pal,MAXPALOOKUPS,0); sprite[spritenum].pal = (char)getnumber16(edittext,(long)sprite[spritenum].pal,MAXPALOOKUPS,0);
} }
} }
else if (col == 2)
{
for (i=Bsprintf(disptext,"Y-Velocity: %d",sprite[spritenum].yvel); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) Y-Velocity: ",spritenum);
if (editval)
{
printmessage16(edittext);
sprite[spritenum].yvel = getnumber16(edittext,(long)sprite[spritenum].yvel,32767,1);
}
}
break; break;
case 3: case 3:
if (col == 1)
{ {
for (i=Bsprintf(disptext,"(X,Y)repeat: %d, %d",sprite[spritenum].xrepeat,sprite[spritenum].yrepeat); i < dispwidth; i++) disptext[i] = ' '; for (i=Bsprintf(disptext,"(X,Y)repeat: %d, %d",sprite[spritenum].xrepeat,sprite[spritenum].yrepeat); i < dispwidth; i++) disptext[i] = ' ';
if (editval) if (editval)
@ -5089,20 +5104,8 @@ void EditSpriteData(short spritenum)
sprite[spritenum].yrepeat = (char)getnumber16(edittext,(long)sprite[spritenum].yrepeat,256L,0); sprite[spritenum].yrepeat = (char)getnumber16(edittext,(long)sprite[spritenum].yrepeat,256L,0);
} }
} }
else if (col == 2)
{
for (i=Bsprintf(disptext,"Z-Velocity: %d",sprite[spritenum].zvel); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) Z-Velocity: ",spritenum);
if (editval)
{
printmessage16(edittext);
sprite[spritenum].zvel = getnumber16(edittext,(long)sprite[spritenum].zvel,32767,1);
}
}
break; break;
case 4: case 4:
if (col == 1)
{ {
for (i=Bsprintf(disptext,"(X,Y)offset: %d, %d",sprite[spritenum].xoffset,sprite[spritenum].yoffset); i < dispwidth; i++) disptext[i] = ' '; for (i=Bsprintf(disptext,"(X,Y)offset: %d, %d",sprite[spritenum].xoffset,sprite[spritenum].yoffset); i < dispwidth; i++) disptext[i] = ' ';
if (editval) if (editval)
@ -5115,20 +5118,8 @@ void EditSpriteData(short spritenum)
sprite[spritenum].yoffset = (char)getnumber16(edittext,(long)sprite[spritenum].yoffset,128L,1); sprite[spritenum].yoffset = (char)getnumber16(edittext,(long)sprite[spritenum].yoffset,128L,1);
} }
} }
else if (col == 2)
{
for (i=Bsprintf(disptext,"Owner: %d",sprite[spritenum].owner); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) Owner: ",spritenum);
if (editval)
{
printmessage16(edittext);
sprite[spritenum].owner = getnumber16(edittext,(long)sprite[spritenum].owner,MAXSPRITES,0);
}
}
break; break;
case 5: case 5:
if (col == 1)
{ {
for (i=Bsprintf(disptext,"Tile number: %d",sprite[spritenum].picnum); i < dispwidth; i++) disptext[i] = ' '; for (i=Bsprintf(disptext,"Tile number: %d",sprite[spritenum].picnum); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) Tile number: ",spritenum); Bsprintf(edittext,"Sprite (%d) Tile number: ",spritenum);
@ -5138,7 +5129,70 @@ void EditSpriteData(short spritenum)
sprite[spritenum].picnum = (short)getnumber16(edittext,(long)sprite[spritenum].picnum,MAXTILES,0); sprite[spritenum].picnum = (short)getnumber16(edittext,(long)sprite[spritenum].picnum,MAXTILES,0);
} }
} }
else if (col == 2) break;
}
}
break;
case 2:
{
switch (row)
{
case 0:
{
for (i=Bsprintf(disptext,"Angle (2048 degrees): %d",sprite[spritenum].ang); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) Angle: ",spritenum);
if (editval)
{
printmessage16(edittext);
sprite[spritenum].ang = (short)getnumber16(edittext,(long)sprite[spritenum].ang,2048L,0);
}
}
break;
case 1:
{
for (i=Bsprintf(disptext,"X-Velocity: %d",sprite[spritenum].xvel); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) X-Velocity: ",spritenum);
if (editval)
{
printmessage16(edittext);
sprite[spritenum].xvel = getnumber16(edittext,(long)sprite[spritenum].xvel,32767,1);
}
}
break;
case 2:
{
for (i=Bsprintf(disptext,"Y-Velocity: %d",sprite[spritenum].yvel); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) Y-Velocity: ",spritenum);
if (editval)
{
printmessage16(edittext);
sprite[spritenum].yvel = getnumber16(edittext,(long)sprite[spritenum].yvel,32767,1);
}
}
break;
case 3:
{
for (i=Bsprintf(disptext,"Z-Velocity: %d",sprite[spritenum].zvel); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) Z-Velocity: ",spritenum);
if (editval)
{
printmessage16(edittext);
sprite[spritenum].zvel = getnumber16(edittext,(long)sprite[spritenum].zvel,32767,1);
}
}
break;
case 4:
{
for (i=Bsprintf(disptext,"Owner: %d",sprite[spritenum].owner); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) Owner: ",spritenum);
if (editval)
{
printmessage16(edittext);
sprite[spritenum].owner = getnumber16(edittext,(long)sprite[spritenum].owner,MAXSPRITES,0);
}
}
break;
case 5:
{ {
for (i=Bsprintf(disptext,"Clipdist: %d",sprite[spritenum].clipdist); i < dispwidth; i++) disptext[i] = ' '; for (i=Bsprintf(disptext,"Clipdist: %d",sprite[spritenum].clipdist); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) Clipdist: ",spritenum); Bsprintf(edittext,"Sprite (%d) Clipdist: ",spritenum);
@ -5148,10 +5202,8 @@ void EditSpriteData(short spritenum)
sprite[spritenum].clipdist = (char)getnumber16(edittext,(long)sprite[spritenum].clipdist,255,0); sprite[spritenum].clipdist = (char)getnumber16(edittext,(long)sprite[spritenum].clipdist,255,0);
} }
} }
break; break;
case 6: case 6:
if (col == 2)
{ {
for (i=Bsprintf(disptext,"Extra: %d",sprite[spritenum].extra); i < dispwidth; i++) disptext[i] = ' '; for (i=Bsprintf(disptext,"Extra: %d",sprite[spritenum].extra); i < dispwidth; i++) disptext[i] = ' ';
Bsprintf(edittext,"Sprite (%d) Extra: ",spritenum); Bsprintf(edittext,"Sprite (%d) Extra: ",spritenum);
@ -5161,9 +5213,12 @@ void EditSpriteData(short spritenum)
sprite[spritenum].extra = getnumber16(edittext,(long)sprite[spritenum].extra,32767,1); sprite[spritenum].extra = getnumber16(edittext,(long)sprite[spritenum].extra,32767,1);
} }
} }
break; break;
} }
}
break;
}
printext16(xpos,ypos+row*8,11,1,disptext,0); printext16(xpos,ypos+row*8,11,1,disptext,0);
if (editval) if (editval)
{ {
@ -5182,187 +5237,6 @@ void EditSpriteData(short spritenum)
// Build edit // Build edit
#define M_RED 12
#define M_BLUE 9
void ResetKeys(void)
{
int i;
for (i = 0; i < MAXKEYBOARDSCAN; i++)
{
keystatus[i] = 0;
}
}
void Msg(char *string, char color)
{
clearmidstatbar16();
printext16(1*4,ydim16+4*8,color,-1,string,0);
}
/*
long GetAToken(char *name, char *tc, long length)
{
int x=0;
char t,*tmp,tokenfound=0;
char *token;
long count=0;
if(!(token = (char *)malloc(9)))
{
Msg("Out of heap space!",M_RED);
return(tokenfound);
}
do{
// Find the token symbol
do {
t = *tc;
tc++;
count++;
} while(t!='@' && count < length);
if(t=='@')
{
tmp = token;
x=1;
do {
// Read in the token
*tmp = t;
tmp++;
t = *tc;
tc++;
x++;
count++;
} while((t>=48 && t<=127) && t!='@' && x < 9 && count < length);
*tmp = 0;
if(!strcmp(name,Bstrupr(token)))
tokenfound = 1;
}
} while(!tokenfound && count < length);
if(!tokenfound) count=0;
return(count);
}
void ContextHelp(short spritenum)
{
int i,fp;
char t,*tc;
char x=0,y=4;
char *name,*hightag;
char *filebuffer;
spritetype *sp;
short lotag=0;
long size=0,tokresult=0;
sp = &sprite[spritenum];
clearmidstatbar16();
if((fp=kopen4load("sehelp.hp2",0)) == -1)
{
Msg("ERROR: Help file not found.",M_RED);
return;
}
// Read in whole file
size = kfilelength(fp);
filebuffer = (char *)malloc(size);
if (filebuffer == NULL)
{
Msg("Not enough memory to load sehelp.hp2",M_RED);
return;
}
if (kread(fp, filebuffer, size) != size)
{
Msg("Unexpected end of file while reading sehelp.hp2",M_RED);
kclose(fp);
return;
}
// close the file
kclose(fp);
// Conver filebuffer to all upper case
//strupr(filebuffer);
// Assign a token name to search for based on the sprite being pointed to.
name = (char *)malloc(20);
hightag = (char *)malloc(sizeof(short));
// Make the token
strcpy(name,"@TAG");
// Make sure 500-600 SOBJ bounding tags all say the same thing.
lotag = sp->lotag;
if(lotag > 500 && lotag <= 600 ) lotag = 500;
// Give help summary for unknown sprites.
if((lotag == 0 || lotag > 1006) && sp->lotag == 0) lotag = 999;
sprintf(hightag,"%d",lotag);
//itoa(lotag,hightag,10);
strcat(name,hightag);
tc = filebuffer;
if(!(tokresult = GetAToken(name,tc,size)))
{
// This message should never happen unless something is real wrong!
Msg("No help available.",M_RED);
return;
}
tc += tokresult;
do {
tc++;
t = *tc;
while(t!='\n' && t!='@' && t!='#' && x<128)
{
tempbuf[x]=t;
tc++;
t = *tc;
x++;
if(x >= 128) break;
}
tempbuf[x]=0;
x=0;
printext16(x*4,ydim16+(y*6)+2,11,-1,tempbuf,1);
y++;
if(y>16)
{
y=18;
printext16(x*4,ydim16+(y*6)+2,11,-1,"Hit any key to continue or Q to quit....",1);
while (bgetchar() == NULL);
if (keystatus[KEYSC_Q])
{
clearmidstatbar16();
return;
}
ResetKeys();
clearmidstatbar16();
y=6;
}
} while(t!='@' && t!='#');
}
*/
void FuncMenuOpts(void) void FuncMenuOpts(void)
{ {
char snotbuf[80]; char snotbuf[80];
@ -5386,7 +5260,7 @@ void FuncMenuOpts(void)
Bsprintf(snotbuf,"Global shade divide"); Bsprintf(snotbuf,"Global shade divide");
printext16(8,ydim-STATUS2DSIZ+104,11,-1,snotbuf,0); printext16(8,ydim-STATUS2DSIZ+104,11,-1,snotbuf,0);
Bsprintf(snotbuf,"Global vis divide"); Bsprintf(snotbuf,"Global visibility divide");
printext16(200,ydim-STATUS2DSIZ+48,11,-1,snotbuf,0); printext16(200,ydim-STATUS2DSIZ+48,11,-1,snotbuf,0);
/* /*
Bsprintf(snotbuf," (0x%x), (0x%x)",sprite[spritenum].hitag,sprite[spritenum].lotag); Bsprintf(snotbuf," (0x%x), (0x%x)",sprite[spritenum].hitag,sprite[spritenum].lotag);
@ -5461,7 +5335,7 @@ void FuncMenu(void)
} }
if (keystatus[0xcb] > 0) if (keystatus[0xcb] > 0)
{ {
/* if (col == 2) /* if (col == 2)
{ {
printext16(xpos,ypos+row*8,11,0,disptext,0); printext16(xpos,ypos+row*8,11,0,disptext,0);
col = 1; col = 1;
@ -5495,7 +5369,7 @@ void FuncMenu(void)
disptext[dispwidth] = 0; disptext[dispwidth] = 0;
if (row > rowmax) row = rowmax; if (row > rowmax) row = rowmax;
} }
/* else if (col == 1) /* else if (col == 1)
{ {
printext16(xpos,ypos+row*8,11,0,disptext,0); printext16(xpos,ypos+row*8,11,0,disptext,0);
col = 2; col = 2;
@ -5515,7 +5389,9 @@ void FuncMenu(void)
switch (col) switch (col)
{ {
case 0: case 0:
if (row == 0) switch (row)
{
case 0:
{ {
for (i=Bsprintf(disptext,"Replace invalid tiles"); i < dispwidth; i++) disptext[i] = ' '; for (i=Bsprintf(disptext,"Replace invalid tiles"); i < dispwidth; i++) disptext[i] = ' ';
if (editval) if (editval)
@ -5544,7 +5420,8 @@ void FuncMenu(void)
printmessage16(tempbuf); printmessage16(tempbuf);
} }
} }
else if (row == 1) break;
case 1:
{ {
for (i=Bsprintf(disptext,"Mass sprite delete"); i < dispwidth; i++) disptext[i] = ' '; for (i=Bsprintf(disptext,"Mass sprite delete"); i < dispwidth; i++) disptext[i] = ' ';
if (editval) if (editval)
@ -5560,7 +5437,8 @@ void FuncMenu(void)
} else printmessage16("Aborted"); } else printmessage16("Aborted");
} }
} }
else if (row == 2) break;
case 2:
{ {
for (i=Bsprintf(disptext,"Global sky shade"); i < dispwidth; i++) disptext[i] = ' '; for (i=Bsprintf(disptext,"Global sky shade"); i < dispwidth; i++) disptext[i] = ' ';
if (editval) if (editval)
@ -5575,7 +5453,8 @@ void FuncMenu(void)
printmessage16("Parallaxed skies adjusted"); printmessage16("Parallaxed skies adjusted");
} }
} }
else if (row == 3) break;
case 3:
{ {
for (i=Bsprintf(disptext,"Global sky height"); i < dispwidth; i++) disptext[i] = ' '; for (i=Bsprintf(disptext,"Global sky height"); i < dispwidth; i++) disptext[i] = ' ';
if (editval) if (editval)
@ -5592,7 +5471,8 @@ void FuncMenu(void)
} else printmessage16("Aborted"); } else printmessage16("Aborted");
} }
} }
else if (row == 4) break;
case 4:
{ {
for (i=Bsprintf(disptext,"Global Z coord shift"); i < dispwidth; i++) disptext[i] = ' '; for (i=Bsprintf(disptext,"Global Z coord shift"); i < dispwidth; i++) disptext[i] = ' ';
if (editval) if (editval)
@ -5611,7 +5491,8 @@ void FuncMenu(void)
} else printmessage16("Aborted"); } else printmessage16("Aborted");
} }
} }
else if (row == 5) break;
case 5:
{ {
for (i=Bsprintf(disptext,"Scale map up"); i < dispwidth; i++) disptext[i] = ' '; for (i=Bsprintf(disptext,"Scale map up"); i < dispwidth; i++) disptext[i] = ' ';
if (editval) if (editval)
@ -5642,7 +5523,8 @@ void FuncMenu(void)
} else printmessage16("Aborted"); } else printmessage16("Aborted");
} }
} }
else if (row == 6) break;
case 6:
{ {
for (i=Bsprintf(disptext,"Scale map down"); i < dispwidth; i++) disptext[i] = ' '; for (i=Bsprintf(disptext,"Scale map down"); i < dispwidth; i++) disptext[i] = ' ';
if (editval) if (editval)
@ -5673,7 +5555,8 @@ void FuncMenu(void)
} else printmessage16("Aborted"); } else printmessage16("Aborted");
} }
} }
else if (row == 7) break;
case 7:
{ {
for (i=Bsprintf(disptext,"Global shade divide"); i < dispwidth; i++) disptext[i] = ' '; for (i=Bsprintf(disptext,"Global shade divide"); i < dispwidth; i++) disptext[i] = ' ';
if (editval) if (editval)
@ -5695,23 +5578,33 @@ void FuncMenu(void)
} }
} }
break; break;
}
break;
case 1: case 1:
if (row == 0) switch (row)
{ {
for (i=Bsprintf(disptext,"Global vis divide"); i < dispwidth; i++) disptext[i] = ' '; case 0:
{
for (i=Bsprintf(disptext,"Global visibility divide"); i < dispwidth; i++) disptext[i] = ' ';
if (editval) if (editval)
{ {
j=getnumber16("Visibility divisor: ",1,127,0); j=getnumber16("Visibility divisor: ",1,127,0);
if(j!=1) if(j!=1)
{ {
for(i=0;i<numsectors;i++) for(i=0;i<numsectors;i++)
{
if(sector[i].visibility < 240)
sector[i].visibility /= j; sector[i].visibility /= j;
else sector[i].visibility = 240 + (sector[i].visibility>>4)/j;
}
printmessage16("Visibility adjusted"); printmessage16("Visibility adjusted");
} else printmessage16("Aborted"); } else printmessage16("Aborted");
} }
} }
break; break;
} }
break;
}
printext16(xpos,ypos+row*8,11,1,disptext,0); printext16(xpos,ypos+row*8,11,1,disptext,0);
enddrawing(); enddrawing();
showframe(1); showframe(1);

View file

@ -358,10 +358,10 @@ void adduserquote(char *daquote)
for(i=MAXUSERQUOTES-1;i>0;i--) for(i=MAXUSERQUOTES-1;i>0;i--)
{ {
strcpy(user_quote[i],user_quote[i-1]); Bstrcpy(user_quote[i],user_quote[i-1]);
user_quote_time[i] = user_quote_time[i-1]; user_quote_time[i] = user_quote_time[i-1];
} }
strcpy(user_quote[0],daquote); Bstrcpy(user_quote[0],daquote);
OSD_Printf("%s\n",strip_color_codes(daquote)); OSD_Printf("%s\n",strip_color_codes(daquote));
user_quote_time[0] = ud.msgdisptime; user_quote_time[0] = ud.msgdisptime;
@ -450,7 +450,7 @@ if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); }
sendpacket(i,packbuf,packbufleng); sendpacket(i,packbuf,packbufleng);
} }
strcpy(boardfilename,packbuf+1); Bstrcpy(boardfilename,packbuf+1);
boardfilename[packbufleng-1] = 0; boardfilename[packbufleng-1] = 0;
if(boardfilename[0] != 0) if(boardfilename[0] != 0)
{ {
@ -653,7 +653,7 @@ if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); }
} }
} }
strcpy(recbuf,packbuf+2); Bstrcpy(recbuf,packbuf+2);
recbuf[packbufleng-2] = 0; recbuf[packbufleng-2] = 0;
adduserquote(recbuf); adduserquote(recbuf);
@ -1605,7 +1605,7 @@ void digitalnumber(long x,long y,long n,char s,char cs)
//ltoa(n,b,10); //ltoa(n,b,10);
Bsnprintf(b,10,"%ld",n); Bsnprintf(b,10,"%ld",n);
i = strlen(b); i = Bstrlen(b);
j = 0; j = 0;
for(k=0;k<i;k++) for(k=0;k<i;k++)
@ -1631,7 +1631,7 @@ void txdigitalnumber(short starttile, long x,long y,long n,char s,char pal,char
//ltoa(n,b,10); //ltoa(n,b,10);
Bsnprintf(b,10,"%ld",n); Bsnprintf(b,10,"%ld",n);
i = strlen(b); i = Bstrlen(b);
j = 0; j = 0;
for(k=0;k<i;k++) for(k=0;k<i;k++)
@ -2368,7 +2368,7 @@ void typemode(void)
if(typebuf[0] == '/' && Btoupper(typebuf[1]) == 'M' && Btoupper(typebuf[2]) == 'E') if(typebuf[0] == '/' && Btoupper(typebuf[1]) == 'M' && Btoupper(typebuf[2]) == 'E')
{ {
strcat(recbuf,"* "); Bstrcat(recbuf,"* ");
i = 3, j = Bstrlen(typebuf); i = 3, j = Bstrlen(typebuf);
Bstrcpy(tempbuf,typebuf); Bstrcpy(tempbuf,typebuf);
while(i < j) while(i < j)
@ -2377,19 +2377,19 @@ void typemode(void)
i++; i++;
} }
typebuf[i-3] = '\0'; typebuf[i-3] = '\0';
strcat(recbuf,ud.user_name[myconnectindex]); Bstrcat(recbuf,ud.user_name[myconnectindex]);
} }
else else
{ {
strcat(recbuf,ud.user_name[myconnectindex]); Bstrcat(recbuf,ud.user_name[myconnectindex]);
strcat(recbuf,": "); Bstrcat(recbuf,": ");
} }
strcat(recbuf,"^0"); Bstrcat(recbuf,"^0");
strcat(recbuf,typebuf); Bstrcat(recbuf,typebuf);
j = strlen(recbuf); j = Bstrlen(recbuf);
recbuf[j] = 0; recbuf[j] = 0;
strcat(tempbuf+2,recbuf); Bstrcat(tempbuf+2,recbuf);
if(sendmessagecommand >= ud.multimode || movesperpacket == 4) if(sendmessagecommand >= ud.multimode || movesperpacket == 4)
{ {
@ -6565,8 +6565,8 @@ void cheats(void)
return; return;
if (VOLUMEONE && !z) { if (VOLUMEONE && !z) {
strcpy(cheatquotes[2],"scotty##"); Bstrcpy(cheatquotes[2],"scotty##");
strcpy(cheatquotes[6],"<RESERVED>"); Bstrcpy(cheatquotes[6],"<RESERVED>");
z=1; z=1;
} }
@ -6856,7 +6856,7 @@ FOUNDCHEAT:
case CHEAT_SKILL: case CHEAT_SKILL:
if(k == CHEAT_SCOTTY) if(k == CHEAT_SCOTTY)
{ {
i = strlen(cheatquotes[k])-3+VOLUMEONE; i = Bstrlen(cheatquotes[k])-3+VOLUMEONE;
if (!consolecheat) { // JBF 20030914 if (!consolecheat) { // JBF 20030914
short volnume,levnume; short volnume,levnume;
if (VOLUMEALL) { if (VOLUMEALL) {
@ -6911,7 +6911,7 @@ FOUNDCHEAT:
} }
else else
{ {
i = strlen(cheatquotes[k])-1; i = Bstrlen(cheatquotes[k])-1;
ud.m_player_skill = ud.player_skill = cheatbuf[i] - '1'; ud.m_player_skill = ud.player_skill = cheatbuf[i] - '1';
} }
if(numplayers > 1 && myconnectindex == connecthead) if(numplayers > 1 && myconnectindex == connecthead)
@ -7244,7 +7244,7 @@ void nonsharedkeys(void)
tempbuf[ch] = 4; tempbuf[ch] = 4;
tempbuf[ch+1] = 255; tempbuf[ch+1] = 255;
tempbuf[ch+2] = 0; tempbuf[ch+2] = 0;
strcat(tempbuf+2,ud.ridecule[i-1]); Bstrcat(tempbuf+2,ud.ridecule[i-1]);
i = 2+strlen(ud.ridecule[i-1]); i = 2+strlen(ud.ridecule[i-1]);
@ -7423,7 +7423,7 @@ FAKE_F3:
screencapt = 0; screencapt = 0;
if( lastsavedpos >= 0 ) if( lastsavedpos >= 0 )
{ {
/* inputloc = strlen(&ud.savegame[lastsavedpos][0]); /* inputloc = Bstrlen(&ud.savegame[lastsavedpos][0]);
current_menu = 360+lastsavedpos; current_menu = 360+lastsavedpos;
probey = lastsavedpos; */ probey = lastsavedpos; */
if(ud.multimode > 1) if(ud.multimode > 1)
@ -7930,7 +7930,7 @@ void checkcommandline(int argc,char **argv)
c++; c++;
if(*c) if(*c)
{ {
strcpy(confilename,c); Bstrcpy(confilename,c);
userconfiles = 1; userconfiles = 1;
/* if(SafeFileExists(c) == 0) /* if(SafeFileExists(c) == 0)
{ {
@ -7945,9 +7945,9 @@ void checkcommandline(int argc,char **argv)
c++; c++;
if(*c) if(*c)
{ {
strcpy(tempbuf,c); Bstrcpy(tempbuf,c);
if( strchr(tempbuf,'.') == 0) if( strchr(tempbuf,'.') == 0)
strcat(tempbuf,".grp"); Bstrcat(tempbuf,".grp");
j = initgroupfile(tempbuf); j = initgroupfile(tempbuf);
if( j == -1 ) if( j == -1 )
@ -8100,9 +8100,9 @@ void checkcommandline(int argc,char **argv)
case 'D': case 'D':
c++; c++;
if( strchr(c,'.') == 0) if( strchr(c,'.') == 0)
strcat(c,".dmo"); Bstrcat(c,".dmo");
initprintf("Play demo %s.\n",c); initprintf("Play demo %s.\n",c);
strcpy(firstdemofile,c); Bstrcpy(firstdemofile,c);
break; break;
case 'l': case 'l':
case 'L': case 'L':
@ -8685,9 +8685,9 @@ void sendboardname(void)
tempbuf[0] = 9; tempbuf[0] = 9;
tempbuf[1] = 0; tempbuf[1] = 0;
j = strlen(boardfilename); j = Bstrlen(boardfilename);
boardfilename[j] = 0; boardfilename[j] = 0;
strcat(tempbuf+1,boardfilename); Bstrcat(tempbuf+1,boardfilename);
for(ch=connecthead;ch >= 0;ch=connectpoint2[ch]) for(ch=connecthead;ch >= 0;ch=connectpoint2[ch])
{ {
@ -9201,7 +9201,7 @@ char opendemoread(char which_demo) // 0 = mine
char ver; char ver;
int32 i; int32 i;
strcpy(d, "demo_.dmo"); Bstrcpy(d, "demo_.dmo");
if(which_demo == 10) if(which_demo == 10)
d[4] = 'x'; d[4] = 'x';