scr_conalpha added

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2022 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-02-25 21:03:56 +00:00
parent 40a6ec9b85
commit ec3d886864
8 changed files with 83 additions and 28 deletions

View File

@ -94,6 +94,8 @@ int scr_copyeverything;
float scr_con_current;
float scr_conlines; // lines of console to display
qboolean scr_con_forcedraw;
float oldscreensize, oldfov;
extern cvar_t scr_viewsize;
extern cvar_t scr_fov;
@ -1336,6 +1338,8 @@ void SCR_SetUpToDrawConsole (void)
#endif
Con_CheckResize ();
scr_con_forcedraw = false;
if (scr_drawloading)
return; // never a console with loading plaque
@ -1351,6 +1355,7 @@ void SCR_SetUpToDrawConsole (void)
{
scr_conlines = vid.height; // full screen
scr_con_current = scr_conlines;
scr_con_forcedraw = true;
}
else if (key_dest == key_console || scr_chatmode)
{

View File

@ -160,6 +160,8 @@ cvar_t scr_sshot_type = SCVAR("scr_sshot_type", "jpg");
cvar_t scr_centersbar = SCVAR("scr_centersbar", "0");
cvar_t scr_consize = SCVAR("scr_consize", "0.5");
cvar_t scr_conalpha = SCVAR("scr_conalpha", "0.7");
cvar_t scr_viewsize = SCVARF("viewsize","100", CVAR_ARCHIVE);
cvar_t scr_fov = SCVARF("fov","90", CVAR_ARCHIVE); // 10 - 170
cvar_t scr_conspeed = SCVAR("scr_conspeed","300");
@ -496,6 +498,7 @@ void Renderer_Init(void)
//screen
Cvar_Register (&scr_conspeed, SCREENOPTIONS);
Cvar_Register (&scr_conalpha, SCREENOPTIONS);
Cvar_Register (&scr_showram, SCREENOPTIONS);
Cvar_Register (&scr_showturtle, SCREENOPTIONS);
Cvar_Register (&scr_showpause, SCREENOPTIONS);

View File

@ -248,7 +248,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
.extern DP_Count
.extern DP_u
.extern DP_v
.extern DP_32768
.extern DP_Partfac
.extern DP_Color
.extern DP_Pix
.extern DP_EntryTable

View File

@ -74,6 +74,7 @@ shader_t *shader_console;
#endif
extern cvar_t con_ocranaleds;
extern cvar_t gl_blend2d;
extern cvar_t scr_conalpha;
qbyte *draw_chars; // 8*8 graphic characters
mpic_t *draw_disc;
@ -1881,14 +1882,26 @@ void GLDraw_ConsoleBackground (int lines)
{
// char ver[80];
// int x, i;
int y;
float a;
extern qboolean scr_con_forcedraw;
y = (vid.height * 3) >> 2;
conback->width = vid.conwidth;
conback->height = vid.conheight;
if (scr_con_forcedraw)
{
a = 1; // console background is necessary
}
else
{
if (scr_conalpha.value <= 0)
return;
a = scr_conalpha.value;
}
if (scr_chatmode == 2)
{
y=0;
conback->height>>=1;
conback->width>>=1;
}
@ -1897,20 +1910,20 @@ void GLDraw_ConsoleBackground (int lines)
if (shader_console)
{
currententity = &r_worldentity;
GLDraw_ShaderPic(0, lines - conback->height, vid.width, vid.height, shader_console, 1, 1, 1, (1.2*lines)/y);
GLDraw_ShaderPic(0, lines - conback->height, vid.width, vid.height, shader_console, 1, 1, 1, a);
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
return;
}
}
#endif
if (lines > y)
if (a >= 1)
{
qglColor3f (1,1,1);
GLDraw_Pic(0, lines-conback->height, conback);
}
else
{
GLDraw_AlphaPic (0, lines - conback->height, conback, (float)(1.2 * lines)/y);
GLDraw_AlphaPic (0, lines - conback->height, conback, a);
}
}

View File

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "d_local.h"
//Spike: Particles are depth sorted. So why depth write? They are the last to be drawn anyway.
#define PARTICLEFACTOR 0x8000 // Change DP_Partfac in ASM to match this
/*
==============
@ -87,7 +87,7 @@ void D_DrawParticle (particle_t *pparticle)
pz = d_pzbuffer + (d_zwidth * v) + u;
pdest = d_viewbuffer + d_scantable[v] + u;
izi = (int)(zi * 0x8000);
izi = (int)(zi * PARTICLEFACTOR);
pix = izi >> d_pix_shift;
pix *= pparticle->scale;
@ -244,9 +244,9 @@ void D_DrawParticle16 (particle_t *pparticle)
}
pz = d_pzbuffer + (d_zwidth * v) + u;
izi = (int)(zi * 0x8000);
izi = (int)(zi * PARTICLEFACTOR);
pix = ((int)(izi*pparticle->scale)) >> d_pix_shift;
pix = ((int)(izi*pparticle->scale));
if (pix < d_pix_min)
pix = d_pix_min;
@ -319,7 +319,7 @@ void D_DrawParticle32 (particle_t *pparticle)
}
pz = d_pzbuffer + (d_zwidth * v) + u;
izi = (int)(zi * 0x8000);
izi = (int)(zi * PARTICLEFACTOR);
pix = ((int)(izi*pparticle->scale)) >> d_pix_shift;
@ -419,7 +419,7 @@ void D_DrawParticleTrans (particle_t *pparticle, blendmode_t blendmode)
}
pz = d_pzbuffer + (d_zwidth * v) + u;
izi = (int)(zi * 0x8000);
izi = (int)(zi * PARTICLEFACTOR);
pix = ((int)(izi*pparticle->scale)) >> d_pix_shift;

View File

@ -134,7 +134,7 @@ C(D_DrawParticle):
fxch %st(1) // u | v | 1/z
fadds float_point5 // u | v | 1/z
fxch %st(2) // 1/z | v | u
fmuls DP_32768 // 1/z * 0x8000 | v | u
fmuls DP_Partfac // 1/z * 0x8000 | v | u
fxch %st(2) // u | v | 1/z * 0x8000
// FIXME: use Terje's fp->int trick here?

View File

@ -146,11 +146,11 @@ entryvec_table_16: .long 0, Entry2_16, Entry3_16, Entry4_16
//-------------------------------------------------------
// local variables for d_parta.s
//-------------------------------------------------------
.globl DP_Count, DP_u, DP_v, DP_32768, DP_Color, DP_Pix, DP_EntryTable
.globl DP_Count, DP_u, DP_v, DP_Partfac, DP_Color, DP_Pix, DP_EntryTable
DP_Count: .long 0
DP_u: .long 0
DP_v: .long 0
DP_32768: .single 32768.0
DP_Partfac: .single 32768.0
DP_Color: .long 0
DP_Pix: .long 0

View File

@ -32,6 +32,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern unsigned int *d_8to32table;
extern cvar_t con_ocranaleds;
extern cvar_t scr_conalpha;
extern qboolean scr_con_forcedraw;
typedef struct {
vrect_t rect;
@ -2016,6 +2018,9 @@ void SWDraw_ConsoleBackground (int lines)
char ver[100];
static char saveback[320*8];
if (!scr_con_forcedraw && scr_conalpha.value <= 0)
return;
conback = (mpic_t *)SWDraw_SafeCachePic ("gfx/conback.lmp");
if (!conback)
conback = (mpic_t *)SWDraw_SafeCachePic("pics/conback.pcx");
@ -2054,30 +2059,56 @@ void SWDraw_ConsoleBackground (int lines)
{
dest = vid.conbuffer;
for (y=0 ; y<lines ; y++, dest += vid.conrowbytes)
if (scr_conalpha.value < 1 && !scr_con_forcedraw)
{
D_SetTransLevel(scr_conalpha.value, BM_BLEND);
v = (vid.conheight - lines + y)*200/vid.conheight;
src = conback->data + v*320;
if (vid.conwidth == 320)
memcpy (dest, src, vid.conwidth);
else
for (y=0 ; y<lines ; y++, dest += vid.conrowbytes)
{
v = (vid.conheight - lines + y)*200/vid.conheight;
src = conback->data + v*320;
f = 0;
fstep = 320*0x10000/vid.conwidth;
for (x=0 ; x<vid.conwidth ; x+=4)
{
dest[x] = src[f>>16];
dest[x] = Trans(dest[x], src[f>>16]);
f += fstep;
dest[x+1] = src[f>>16];
dest[x+1] = Trans(dest[x+1], src[f>>16]);
f += fstep;
dest[x+2] = src[f>>16];
dest[x+2] = Trans(dest[x+2], src[f>>16]);
f += fstep;
dest[x+3] = src[f>>16];
dest[x+3] = Trans(dest[x+3], src[f>>16]);
f += fstep;
}
}
}
else
{
for (y=0 ; y<lines ; y++, dest += vid.conrowbytes)
{
v = (vid.conheight - lines + y)*200/vid.conheight;
src = conback->data + v*320;
if (vid.conwidth == 320)
memcpy (dest, src, vid.conwidth);
else
{
f = 0;
fstep = 320*0x10000/vid.conwidth;
for (x=0 ; x<vid.conwidth ; x+=4)
{
dest[x] = src[f>>16];
f += fstep;
dest[x+1] = src[f>>16];
f += fstep;
dest[x+2] = src[f>>16];
f += fstep;
dest[x+3] = src[f>>16];
f += fstep;
}
}
}
}
}
else if (r_pixbytes == 2)
{
@ -2114,8 +2145,11 @@ void SWDraw_ConsoleBackground (int lines)
extern cvar_t d_smooth;
unsigned int *p24dest;
unsigned char *pal = (qbyte *)d_8to32table;
int alpha = ((float)(lines)/((vid.height * 3) >> 2))*255;
if (alpha > 255) alpha = 255;
int alpha;
if (scr_con_forcedraw)
alpha = 255;
else
alpha = bound(0, scr_conalpha.value*255, 255);
p24dest = (unsigned int *)vid.conbuffer;
dest = (unsigned char *)vid.conbuffer;