03 Dec 2010
This commit is contained in:
parent
533ab6c699
commit
0fb9a42998
|
@ -278,4 +278,43 @@ typedef struct auxvert_s
|
|||
float fv[3]; // viewspace x, y
|
||||
} auxvert_t;
|
||||
|
||||
//
|
||||
// sprite representation in memory
|
||||
//
|
||||
typedef enum { SPR_SINGLE = 0, SPR_GROUP, SPR_ANGLED } spriteframetype_t;
|
||||
|
||||
typedef struct mspriteframe_s
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
float up, down, left, right;
|
||||
int gl_texturenum;
|
||||
} mspriteframe_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int numframes;
|
||||
float *intervals;
|
||||
mspriteframe_t *frames[1];
|
||||
} mspritegroup_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
spriteframetype_t type;
|
||||
mspriteframe_t *frameptr;
|
||||
} mspriteframedesc_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short type;
|
||||
short texFormat;
|
||||
int maxwidth;
|
||||
int maxheight;
|
||||
int numframes;
|
||||
int radius;
|
||||
int facecull;
|
||||
int synctype;
|
||||
mspriteframedesc_t frames[1];
|
||||
} msprite_t;
|
||||
|
||||
#endif//COM_MODEL_H
|
|
@ -28,7 +28,7 @@ typedef enum
|
|||
#define TRI_TRIANGLE_FAN 1
|
||||
#define TRI_QUADS 2
|
||||
#define TRI_POLYGON 3
|
||||
#define TRI_LINES 4
|
||||
#define TRI_LINES 4
|
||||
#define TRI_TRIANGLE_STRIP 5
|
||||
#define TRI_QUAD_STRIP 6
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ void CL_ScreenShot_f( void )
|
|||
}
|
||||
|
||||
Con_ClearNotify();
|
||||
re->ScrShot( checkname, VID_SCREENSHOT );
|
||||
VID_ScreenShot( checkname, VID_SCREENSHOT );
|
||||
}
|
||||
|
||||
void CL_EnvShot_f( void )
|
||||
|
@ -310,7 +310,8 @@ void CL_SetSky_f( void )
|
|||
Msg( "Usage: skyname <shadername>\n" );
|
||||
return;
|
||||
}
|
||||
re->RegisterShader( Cmd_Argv(1), SHADER_SKY );
|
||||
|
||||
R_SetupSky( Cmd_Argv( 1 ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -334,13 +335,13 @@ void SCR_TimeRefresh_f( void )
|
|||
if( Cmd_Argc() == 2 )
|
||||
{
|
||||
// run without page flipping
|
||||
re->BeginFrame( false );
|
||||
R_BeginFrame( false );
|
||||
for( i = 0; i < 128; i++ )
|
||||
{
|
||||
cl.refdef.viewangles[1] = i / 128.0 * 360.0f;
|
||||
re->RenderFrame( &cl.refdef, true );
|
||||
R_RenderFrame( &cl.refdef, true );
|
||||
}
|
||||
re->EndFrame();
|
||||
R_EndFrame();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -348,9 +349,9 @@ void SCR_TimeRefresh_f( void )
|
|||
{
|
||||
cl.refdef.viewangles[1] = i / 128.0 * 360.0f;
|
||||
|
||||
re->BeginFrame( true );
|
||||
re->RenderFrame( &cl.refdef, true );
|
||||
re->EndFrame();
|
||||
R_BeginFrame( true );
|
||||
R_RenderFrame( &cl.refdef, true );
|
||||
R_EndFrame();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType )
|
|||
ent->curstate.renderamt = 255; // clear amount
|
||||
}
|
||||
|
||||
result = re->AddRefEntity( ent, entityType, -1 );
|
||||
result = R_AddEntity( ent, entityType, -1 );
|
||||
|
||||
if( ent->curstate.renderfx == kRenderFxGlowShell )
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType )
|
|||
ent->curstate.renderamt = 128;
|
||||
|
||||
// render glowshell
|
||||
result |= re->AddRefEntity( ent, entityType, cls.glowShell ); // FIXME
|
||||
result |= R_AddEntity( ent, entityType, cls.glowShell ); // FIXME
|
||||
|
||||
// restore parms
|
||||
ent->curstate.scale = oldScale;
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#include "cl_tent.h"
|
||||
#include "input.h"
|
||||
#include "shake.h"
|
||||
#include "sprite.h"
|
||||
#include "gl_local.h"
|
||||
|
||||
#define MAX_TEXTCHANNELS 8 // must be power of two (GoldSrc uses 4 channel)
|
||||
#define TEXT_MSGNAME "TextMessage%i"
|
||||
|
@ -264,13 +266,13 @@ void CL_StudioEvent( struct mstudioevent_s *event, cl_entity_t *pEdict )
|
|||
CL_FadeAlpha
|
||||
================
|
||||
*/
|
||||
void CL_FadeAlpha( int starttime, int endtime, rgba_t color )
|
||||
void CL_FadeAlpha( int starttime, int endtime, byte *alpha )
|
||||
{
|
||||
int time, fade_time;
|
||||
|
||||
if( starttime == 0 )
|
||||
{
|
||||
MakeRGBA( color, 255, 255, 255, 255 );
|
||||
*alpha = 255;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -278,7 +280,7 @@ void CL_FadeAlpha( int starttime, int endtime, rgba_t color )
|
|||
|
||||
if( time >= endtime )
|
||||
{
|
||||
MakeRGBA( color, 255, 255, 255, 0 );
|
||||
*alpha = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -286,12 +288,10 @@ void CL_FadeAlpha( int starttime, int endtime, rgba_t color )
|
|||
fade_time = endtime / 4;
|
||||
fade_time = bound( 300, fade_time, 10000 );
|
||||
|
||||
color[0] = color[1] = color[2] = 255;
|
||||
|
||||
// fade out
|
||||
if(( endtime - time ) < fade_time )
|
||||
color[3] = bound( 0, (( endtime - time ) * ( 1.0f / fade_time )) * 255, 255 );
|
||||
else color[3] = 255;
|
||||
*alpha = bound( 0, (( endtime - time ) * ( 1.0f / fade_time )) * 255, 255 );
|
||||
else *alpha = 255;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -476,15 +476,14 @@ draw hudsprite routine
|
|||
static void SPR_DrawGeneric( int frame, float x, float y, float width, float height, const wrect_t *prc )
|
||||
{
|
||||
float s1, s2, t1, t2;
|
||||
|
||||
if( !re ) return;
|
||||
int texnum;
|
||||
|
||||
if( width == -1 && height == -1 )
|
||||
{
|
||||
int w, h;
|
||||
|
||||
// assume we get sizes from image
|
||||
re->GetParms( &w, &h, NULL, frame, clgame.ds.hSprite );
|
||||
R_GetSpriteParms( &w, &h, NULL, frame, clgame.ds.pSprite );
|
||||
|
||||
width = w;
|
||||
height = h;
|
||||
|
@ -512,7 +511,8 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei
|
|||
|
||||
// scale for screen sizes
|
||||
SPR_AdjustSize( &x, &y, &width, &height );
|
||||
re->DrawStretchPic( x, y, width, height, s1, t1, s2, t2, clgame.ds.hSprite );
|
||||
texnum = R_GetSpriteTexture( clgame.ds.pSprite, frame );
|
||||
R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, texnum );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -528,14 +528,14 @@ static void CL_DrawCenterPrint( void )
|
|||
int i, j, x, y;
|
||||
int width, lineLength;
|
||||
byte line[80];
|
||||
rgba_t color;
|
||||
byte alpha;
|
||||
|
||||
if( !clgame.centerPrint.time )
|
||||
return;
|
||||
|
||||
CL_FadeAlpha( clgame.centerPrint.time, scr_centertime->value * 1000, color );
|
||||
CL_FadeAlpha( clgame.centerPrint.time, scr_centertime->value * 1000, &alpha );
|
||||
|
||||
if( *(int *)color == 0x00FFFFFF )
|
||||
if( !alpha )
|
||||
{
|
||||
// faded out
|
||||
clgame.centerPrint.time = 0;
|
||||
|
@ -570,10 +570,8 @@ static void CL_DrawCenterPrint( void )
|
|||
|
||||
if( x >= 0 && y >= 0 && next <= clgame.scrInfo.iWidth )
|
||||
{
|
||||
re->SetColor( color );
|
||||
clgame.ds.hSprite = cls.creditsFont.hFontTexture;
|
||||
re->SetParms( clgame.ds.hSprite, kRenderTransAdd, 0 );
|
||||
SPR_DrawGeneric( 0, x, y, -1, -1, &cls.creditsFont.fontRc[ch] );
|
||||
pfnPIC_Set( cls.creditsFont.hFontTexture, 255, 255, 255, alpha );
|
||||
pfnPIC_DrawAdditive( x, y, -1, -1, &cls.creditsFont.fontRc[ch] );
|
||||
}
|
||||
x = next;
|
||||
}
|
||||
|
@ -623,14 +621,12 @@ void CL_DrawScreenFade( void )
|
|||
iFadeAlpha = bound( 0, iFadeAlpha, sf->fadealpha );
|
||||
}
|
||||
|
||||
if( !re ) return;
|
||||
|
||||
MakeRGBA( color, sf->fader, sf->fadeg, sf->fadeb, iFadeAlpha );
|
||||
re->SetColor( color );
|
||||
R_DrawSetColor( color );
|
||||
|
||||
re->SetParms( cls.fillShader, kRenderTransTexture, 0 );
|
||||
re->DrawStretchPic( 0, 0, scr_width->integer, scr_height->integer, 0, 0, 1, 1, cls.fillShader );
|
||||
re->SetColor( NULL );
|
||||
GL_SetRenderMode( kRenderTransTexture );
|
||||
R_DrawStretchPic( 0, 0, scr_width->integer, scr_height->integer, 0, 0, 1, 1, cls.fillImage );
|
||||
R_DrawSetColor( NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -771,7 +767,7 @@ void CL_DrawCrosshair( void )
|
|||
int x, y, width, height;
|
||||
cl_entity_t *pPlayer;
|
||||
|
||||
if( !re || clgame.ds.hCrosshair <= 0 || cl.refdef.crosshairangle[2] || !cl_crosshair->integer )
|
||||
if( !clgame.ds.pCrosshair || cl.refdef.crosshairangle[2] || !cl_crosshair->integer )
|
||||
return;
|
||||
|
||||
pPlayer = CL_GetLocalPlayer();
|
||||
|
@ -801,15 +797,16 @@ void CL_DrawCrosshair( void )
|
|||
VectorAdd( cl.refdef.viewangles, cl.refdef.crosshairangle, angles );
|
||||
AngleVectors( angles, forward, NULL, NULL );
|
||||
VectorAdd( cl.refdef.vieworg, forward, point );
|
||||
re->WorldToScreen( point, screen );
|
||||
R_WorldToScreen( point, screen );
|
||||
|
||||
x += 0.5f * screen[0] * scr_width->integer + 0.5f;
|
||||
y += 0.5f * screen[1] * scr_height->integer + 0.5f;
|
||||
}
|
||||
|
||||
clgame.ds.hSprite = clgame.ds.hCrosshair;
|
||||
re->SetColor( clgame.ds.rgbaCrosshair );
|
||||
re->SetParms( clgame.ds.hSprite, kRenderTransAlpha, 0 );
|
||||
clgame.ds.pSprite = clgame.ds.pCrosshair;
|
||||
|
||||
GL_SetRenderMode( kRenderTransAlpha );
|
||||
R_DrawSetColor( clgame.ds.rgbaCrosshair );
|
||||
SPR_DrawGeneric( 0, x - 0.5f * width, y - 0.5f * height, -1, -1, &clgame.ds.rcCrosshair );
|
||||
}
|
||||
|
||||
|
@ -826,7 +823,7 @@ static void CL_DrawLoading( float percent )
|
|||
float xscale, yscale, step, s2;
|
||||
rgba_t color;
|
||||
|
||||
re->GetParms( &width, &height, NULL, 0, cls.loadingBar );
|
||||
R_GetTextureParms( &width, &height, cls.loadingBar );
|
||||
x = ( 640 - width ) >> 1;
|
||||
y = ( 480 - height) >> 1;
|
||||
|
||||
|
@ -839,9 +836,9 @@ static void CL_DrawLoading( float percent )
|
|||
height *= yscale;
|
||||
|
||||
MakeRGBA( color, 128, 128, 128, 255 );
|
||||
re->SetColor( color );
|
||||
re->SetParms( cls.loadingBar, kRenderTransTexture, 0 );
|
||||
re->DrawStretchPic( x, y, width, height, 0, 0, 1, 1, cls.loadingBar );
|
||||
R_DrawSetColor( color );
|
||||
GL_SetRenderMode( kRenderTransTexture );
|
||||
R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, cls.loadingBar );
|
||||
|
||||
step = (float)width / 100.0f;
|
||||
right = (int)ceil( percent * step );
|
||||
|
@ -849,10 +846,10 @@ static void CL_DrawLoading( float percent )
|
|||
width = right;
|
||||
|
||||
MakeRGBA( color, 208, 152, 0, 255 );
|
||||
re->SetColor( color );
|
||||
re->SetParms( cls.loadingBar, kRenderTransTexture, 0 );
|
||||
re->DrawStretchPic( x, y, width, height, 0, 0, s2, 1, cls.loadingBar );
|
||||
re->SetColor( NULL );
|
||||
R_DrawSetColor( color );
|
||||
GL_SetRenderMode( kRenderTransTexture );
|
||||
R_DrawStretchPic( x, y, width, height, 0, 0, s2, 1, cls.loadingBar );
|
||||
R_DrawSetColor( NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -867,9 +864,7 @@ static void CL_DrawPause( void )
|
|||
int x, y, width, height;
|
||||
float xscale, yscale;
|
||||
|
||||
if( !re ) return;
|
||||
|
||||
re->GetParms( &width, &height, NULL, 0, cls.pauseIcon );
|
||||
R_GetTextureParms( &width, &height, cls.pauseIcon );
|
||||
x = ( 640 - width ) >> 1;
|
||||
y = ( 480 - height) >> 1;
|
||||
|
||||
|
@ -881,9 +876,9 @@ static void CL_DrawPause( void )
|
|||
width *= xscale;
|
||||
height *= yscale;
|
||||
|
||||
re->SetColor( NULL );
|
||||
re->SetParms( cls.pauseIcon, kRenderTransTexture, 0 );
|
||||
re->DrawStretchPic( x, y, width, height, 0, 0, 1, 1, cls.pauseIcon );
|
||||
R_DrawSetColor( NULL );
|
||||
GL_SetRenderMode( kRenderTransTexture );
|
||||
R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, cls.pauseIcon );
|
||||
}
|
||||
|
||||
void CL_DrawHUD( int state )
|
||||
|
@ -1334,33 +1329,32 @@ void CL_FreeEdicts( void )
|
|||
|
||||
===============================================================================
|
||||
*/
|
||||
static qboolean CL_LoadHudSprite( const char *szPicName, model_t *m_pSprite, int shaderType )
|
||||
static qboolean CL_LoadHudSprite( const char *szSpriteName, model_t *m_pSprite, qboolean mapSprite )
|
||||
{
|
||||
byte *buf;
|
||||
size_t size;
|
||||
|
||||
ASSERT( m_pSprite != NULL );
|
||||
|
||||
// register new sprite
|
||||
com.strncpy( m_pSprite->name, szPicName, sizeof( m_pSprite->name ));
|
||||
m_pSprite->firstmodelsurface = re->RegisterShader( m_pSprite->name, shaderType );
|
||||
buf = FS_LoadFile( szSpriteName, &size );
|
||||
if( !buf ) return false;
|
||||
|
||||
if( !m_pSprite->firstmodelsurface )
|
||||
com.strncpy( m_pSprite->name, szSpriteName, sizeof( m_pSprite->name ));
|
||||
m_pSprite->registration_sequence = cm.registration_sequence;
|
||||
|
||||
if( mapSprite ) Mod_LoadMapSprite( m_pSprite, buf, size );
|
||||
else Mod_LoadSpriteModel( m_pSprite, buf );
|
||||
|
||||
Mem_Free( buf );
|
||||
|
||||
if( m_pSprite->type != mod_sprite )
|
||||
{
|
||||
// can't loading or something
|
||||
Mem_Set( m_pSprite, 0, sizeof( *m_pSprite ));
|
||||
return false;
|
||||
}
|
||||
|
||||
re->GetParms( NULL, NULL, &m_pSprite->numframes, 0, m_pSprite->firstmodelsurface );
|
||||
return true;
|
||||
}
|
||||
|
||||
static shader_t CL_GetHudSpriteShader( HSPRITE hSpr )
|
||||
{
|
||||
if( hSpr <= 0 || hSpr > MAX_IMAGES )
|
||||
return 0; // bad image
|
||||
|
||||
return clgame.ds.images[hSpr].firstmodelsurface;
|
||||
}
|
||||
|
||||
/*
|
||||
=========
|
||||
pfnSPR_Load
|
||||
|
@ -1371,7 +1365,6 @@ HSPRITE pfnSPR_Load( const char *szPicName )
|
|||
{
|
||||
int i;
|
||||
|
||||
if( !re ) return 0; // render not initialized
|
||||
if( !szPicName || !*szPicName )
|
||||
{
|
||||
MsgDev( D_ERROR, "CL_LoadSprite: bad name!\n" );
|
||||
|
@ -1379,14 +1372,13 @@ HSPRITE pfnSPR_Load( const char *szPicName )
|
|||
}
|
||||
|
||||
// slot 0 isn't used
|
||||
for( i = 1; i < MAX_IMAGES && clgame.ds.images[i].name[0]; i++ )
|
||||
for( i = 1; i < MAX_IMAGES && clgame.sprites[i].name[0]; i++ )
|
||||
{
|
||||
if( !com.strcmp( clgame.ds.images[i].name, szPicName ))
|
||||
if( !com.strcmp( clgame.sprites[i].name, szPicName ))
|
||||
{
|
||||
// refresh shader
|
||||
if( CL_LoadHudSprite( szPicName, &clgame.ds.images[i], SHADER_SPRITE ))
|
||||
return i;
|
||||
return 0;
|
||||
// prolonge registration
|
||||
clgame.sprites[i].registration_sequence = cm.registration_sequence;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1396,12 +1388,25 @@ HSPRITE pfnSPR_Load( const char *szPicName )
|
|||
return 0;
|
||||
}
|
||||
|
||||
// load new shader
|
||||
if( CL_LoadHudSprite( szPicName, &clgame.ds.images[i], SHADER_SPRITE ))
|
||||
// load new model
|
||||
if( CL_LoadHudSprite( szPicName, &clgame.sprites[i], false ))
|
||||
return i;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
CL_GetSpritePointer
|
||||
|
||||
=============
|
||||
*/
|
||||
const model_t *CL_GetSpritePointer( HSPRITE hSprite )
|
||||
{
|
||||
if( hSprite <= 0 || hSprite > ( MAX_IMAGES - 1 ))
|
||||
return 0; // bad image
|
||||
return &clgame.sprites[hSprite];
|
||||
}
|
||||
|
||||
/*
|
||||
=========
|
||||
pfnSPR_Frames
|
||||
|
@ -1412,8 +1417,7 @@ static int pfnSPR_Frames( HSPRITE hPic )
|
|||
{
|
||||
int numFrames;
|
||||
|
||||
if( !re ) return 1;
|
||||
re->GetParms( NULL, NULL, &numFrames, 0, CL_GetHudSpriteShader( hPic ));
|
||||
R_GetSpriteParms( NULL, NULL, &numFrames, 0, CL_GetSpritePointer( hPic ));
|
||||
|
||||
return numFrames;
|
||||
}
|
||||
|
@ -1428,8 +1432,7 @@ static int pfnSPR_Height( HSPRITE hPic, int frame )
|
|||
{
|
||||
int sprHeight;
|
||||
|
||||
if( !re ) return 0;
|
||||
re->GetParms( NULL, &sprHeight, NULL, frame, CL_GetHudSpriteShader( hPic ));
|
||||
R_GetSpriteParms( NULL, &sprHeight, NULL, frame, CL_GetSpritePointer( hPic ));
|
||||
|
||||
return sprHeight;
|
||||
}
|
||||
|
@ -1444,8 +1447,7 @@ static int pfnSPR_Width( HSPRITE hPic, int frame )
|
|||
{
|
||||
int sprWidth;
|
||||
|
||||
if( !re ) return 0;
|
||||
re->GetParms( &sprWidth, NULL, NULL, frame, CL_GetHudSpriteShader( hPic ));
|
||||
R_GetSpriteParms( &sprWidth, NULL, NULL, frame, CL_GetSpritePointer( hPic ));
|
||||
|
||||
return sprWidth;
|
||||
}
|
||||
|
@ -1460,14 +1462,12 @@ static void pfnSPR_Set( HSPRITE hPic, int r, int g, int b )
|
|||
{
|
||||
rgba_t color;
|
||||
|
||||
if( !re ) return; // render not initialized
|
||||
|
||||
clgame.ds.hSprite = CL_GetHudSpriteShader( hPic );
|
||||
clgame.ds.pSprite = CL_GetSpritePointer( hPic );
|
||||
color[0] = bound( 0, r, 255 );
|
||||
color[1] = bound( 0, g, 255 );
|
||||
color[2] = bound( 0, b, 255 );
|
||||
color[3] = 255;
|
||||
re->SetColor( color );
|
||||
R_DrawSetColor( color );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1478,9 +1478,7 @@ pfnSPR_Draw
|
|||
*/
|
||||
static void pfnSPR_Draw( int frame, int x, int y, const wrect_t *prc )
|
||||
{
|
||||
if( !re ) return; // render not initialized
|
||||
|
||||
re->SetParms( clgame.ds.hSprite, kRenderNormal, frame );
|
||||
GL_SetRenderMode( kRenderNormal );
|
||||
SPR_DrawGeneric( frame, x, y, -1, -1, prc );
|
||||
}
|
||||
|
||||
|
@ -1492,9 +1490,7 @@ pfnSPR_DrawHoles
|
|||
*/
|
||||
static void pfnSPR_DrawHoles( int frame, int x, int y, const wrect_t *prc )
|
||||
{
|
||||
if( !re ) return; // render not initialized
|
||||
|
||||
re->SetParms( clgame.ds.hSprite, kRenderTransAlpha, frame );
|
||||
GL_SetRenderMode( kRenderTransAlpha );
|
||||
SPR_DrawGeneric( frame, x, y, -1, -1, prc );
|
||||
}
|
||||
|
||||
|
@ -1506,9 +1502,7 @@ pfnSPR_DrawAdditive
|
|||
*/
|
||||
static void pfnSPR_DrawAdditive( int frame, int x, int y, const wrect_t *prc )
|
||||
{
|
||||
if( !re ) return; // render not initialized
|
||||
|
||||
re->SetParms( clgame.ds.hSprite, kRenderTransAdd, frame );
|
||||
GL_SetRenderMode( kRenderTransAdd );
|
||||
SPR_DrawGeneric( frame, x, y, -1, -1, prc );
|
||||
}
|
||||
|
||||
|
@ -1625,16 +1619,14 @@ static void pfnFillRGBA( int x, int y, int width, int height, int r, int g, int
|
|||
{
|
||||
rgba_t color;
|
||||
|
||||
if( !re ) return;
|
||||
|
||||
MakeRGBA( color, r, g, b, a );
|
||||
re->SetColor( color );
|
||||
R_DrawSetColor( color );
|
||||
|
||||
SPR_AdjustSize( (float *)&x, (float *)&y, (float *)&width, (float *)&height );
|
||||
|
||||
re->SetParms( cls.fillShader, kRenderTransTexture, 0 );
|
||||
re->DrawStretchPic( x, y, width, height, 0, 0, 1, 1, cls.fillShader );
|
||||
re->SetColor( NULL );
|
||||
GL_SetRenderMode( kRenderTransTexture );
|
||||
R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, cls.fillImage );
|
||||
R_DrawSetColor( NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1696,7 +1688,7 @@ static void pfnSetCrosshair( HSPRITE hspr, wrect_t rc, int r, int g, int b )
|
|||
clgame.ds.rgbaCrosshair[1] = (byte)g;
|
||||
clgame.ds.rgbaCrosshair[2] = (byte)b;
|
||||
clgame.ds.rgbaCrosshair[3] = (byte)0xFF;
|
||||
clgame.ds.hCrosshair = CL_GetHudSpriteShader( hspr );
|
||||
clgame.ds.pCrosshair = CL_GetSpritePointer( hspr );
|
||||
clgame.ds.rcCrosshair = rc;
|
||||
}
|
||||
|
||||
|
@ -1865,8 +1857,6 @@ returns drawed chachter width (in real screen pixels)
|
|||
*/
|
||||
static int pfnDrawCharacter( int x, int y, int number, int r, int g, int b )
|
||||
{
|
||||
rgba_t color;
|
||||
|
||||
if( !cls.creditsFont.valid )
|
||||
return 0;
|
||||
|
||||
|
@ -1876,10 +1866,9 @@ static int pfnDrawCharacter( int x, int y, int number, int r, int g, int b )
|
|||
if( y < -clgame.scrInfo.iCharHeight )
|
||||
return 0;
|
||||
|
||||
MakeRGBA( color, r, g, b, 255 );
|
||||
re->SetColor( color );
|
||||
clgame.ds.hSprite = cls.creditsFont.hFontTexture;
|
||||
pfnSPR_DrawAdditive( 0, x, y, &cls.creditsFont.fontRc[number] );
|
||||
pfnPIC_Set( cls.creditsFont.hFontTexture, r, g, b, 255 );
|
||||
pfnPIC_DrawAdditive( x, y, -1, -1, &cls.creditsFont.fontRc[number] );
|
||||
|
||||
return clgame.scrInfo.charWidths[number];
|
||||
}
|
||||
|
||||
|
@ -2600,21 +2589,7 @@ pfnBoxVisible
|
|||
*/
|
||||
static qboolean pfnBoxVisible( const vec3_t mins, const vec3_t maxs )
|
||||
{
|
||||
if( !re ) return false;
|
||||
return Mod_BoxVisible( mins, maxs, re->GetCurrentVis());
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
CL_GetSpritePointer
|
||||
|
||||
=============
|
||||
*/
|
||||
const model_t *CL_GetSpritePointer( HSPRITE hSprite )
|
||||
{
|
||||
if( hSprite <= 0 || hSprite > MAX_IMAGES )
|
||||
return 0; // bad image
|
||||
return &clgame.ds.images[hSprite];
|
||||
return Mod_BoxVisible( mins, maxs, Mod_GetCurrentVis( ));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2636,7 +2611,7 @@ model_t *CL_LoadModel( const char *modelname, int *index )
|
|||
|
||||
int CL_AddEntity( int entityType, cl_entity_t *pEnt )
|
||||
{
|
||||
if( !re || !pEnt || !pEnt->index )
|
||||
if( !pEnt || !pEnt->index )
|
||||
return false;
|
||||
|
||||
// let the render reject entity without model
|
||||
|
@ -2715,35 +2690,33 @@ model_t *pfnLoadMapSprite( const char *filename )
|
|||
{
|
||||
int i;
|
||||
|
||||
if( !re ) return NULL; // render not initialized
|
||||
if( !filename || !*filename )
|
||||
{
|
||||
MsgDev( D_ERROR, "CL_LoadMapSprite: bad name!\n" );
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// slot 0 isn't used
|
||||
for( i = 1; i < MAX_IMAGES && clgame.ds.images[i].name[0]; i++ )
|
||||
for( i = 1; i < MAX_IMAGES && clgame.sprites[i].name[0]; i++ )
|
||||
{
|
||||
if( !com.strcmp( clgame.ds.images[i].name, filename ))
|
||||
if( !com.strcmp( clgame.sprites[i].name, filename ))
|
||||
{
|
||||
// refresh shader
|
||||
if( CL_LoadHudSprite( filename, &clgame.ds.images[i], SHADER_GENERIC ))
|
||||
return clgame.ds.images + i;
|
||||
return 0;
|
||||
// prolonge registration
|
||||
clgame.sprites[i].registration_sequence = cm.registration_sequence;
|
||||
return &clgame.sprites[i];
|
||||
}
|
||||
}
|
||||
|
||||
if( i == MAX_IMAGES )
|
||||
{
|
||||
MsgDev( D_ERROR, "LoadMapSprite: can't load %s, MAX_HSPRITES limit exceeded\n", filename );
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// load new shader
|
||||
if( CL_LoadHudSprite( filename, &clgame.ds.images[i], SHADER_GENERIC ))
|
||||
return clgame.ds.images + i;
|
||||
return 0;
|
||||
// load new map sprite
|
||||
if( CL_LoadHudSprite( filename, &clgame.sprites[i], true ))
|
||||
return &clgame.sprites[i];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2922,20 +2895,6 @@ static void pfnEnvShot( const float *vieworg, const char *name, int skyshot )
|
|||
else cls.scrshot_action = scrshot_envshot;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
pfnSkyCamera
|
||||
|
||||
=================
|
||||
*/
|
||||
static void pfnSkyCamera( const float *vieworg, const float *viewangles, float scale, float fov )
|
||||
{
|
||||
if( !re || !vieworg || !viewangles )
|
||||
return;
|
||||
|
||||
re->SetSkyPortal( vieworg, viewangles, scale, fov );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
TriApi implementation
|
||||
|
@ -2964,18 +2923,6 @@ void Tri_DrawTriangles( int fTrans )
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
TriRenderMode
|
||||
|
||||
=============
|
||||
*/
|
||||
void TriRenderMode( int mode )
|
||||
{
|
||||
if( !re ) return;
|
||||
re->RenderMode( mode );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
TriBegin
|
||||
|
@ -2985,7 +2932,32 @@ begin triangle sequence
|
|||
*/
|
||||
void TriBegin( int mode )
|
||||
{
|
||||
if( re ) re->Begin( mode );
|
||||
switch( mode )
|
||||
{
|
||||
case TRI_TRIANGLES:
|
||||
mode = GL_TRIANGLES;
|
||||
break;
|
||||
case TRI_TRIANGLE_FAN:
|
||||
mode = GL_TRIANGLE_FAN;
|
||||
break;
|
||||
case TRI_QUADS:
|
||||
mode = GL_QUADS;
|
||||
break;
|
||||
case TRI_LINES:
|
||||
mode = GL_LINES;
|
||||
break;
|
||||
case TRI_TRIANGLE_STRIP:
|
||||
mode = GL_TRIANGLE_STRIP;
|
||||
break;
|
||||
case TRI_QUAD_STRIP:
|
||||
mode = GL_QUAD_STRIP;
|
||||
break;
|
||||
case TRI_POLYGON:
|
||||
default: mode = GL_POLYGON;
|
||||
break;
|
||||
}
|
||||
|
||||
pglBegin( mode );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2997,7 +2969,7 @@ draw triangle sequence
|
|||
*/
|
||||
void TriEnd( void )
|
||||
{
|
||||
if( re ) re->End();
|
||||
pglEnd();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3010,12 +2982,11 @@ void TriColor4f( float r, float g, float b, float a )
|
|||
{
|
||||
rgba_t rgba;
|
||||
|
||||
if( !re ) return;
|
||||
rgba[0] = (byte)bound( 0, (r * 255.0f), 255 );
|
||||
rgba[1] = (byte)bound( 0, (g * 255.0f), 255 );
|
||||
rgba[2] = (byte)bound( 0, (b * 255.0f), 255 );
|
||||
rgba[3] = (byte)bound( 0, (a * 255.0f), 255 );
|
||||
re->Color4ub( rgba[0], rgba[1], rgba[2], rgba[3] );
|
||||
pglColor4ub( rgba[0], rgba[1], rgba[2], rgba[3] );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3026,8 +2997,7 @@ TriColor4ub
|
|||
*/
|
||||
void TriColor4ub( byte r, byte g, byte b, byte a )
|
||||
{
|
||||
if( !re ) return;
|
||||
re->Color4ub( r, g, b, a );
|
||||
pglColor4ub( r, g, b, a );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3038,8 +3008,7 @@ TriTexCoord2f
|
|||
*/
|
||||
void TriTexCoord2f( float u, float v )
|
||||
{
|
||||
if( !re ) return;
|
||||
re->TexCoord2f( u, v );
|
||||
pglTexCoord2f( u, v );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3050,8 +3019,7 @@ TriVertex3fv
|
|||
*/
|
||||
void TriVertex3fv( const float *v )
|
||||
{
|
||||
if( !re || !v ) return;
|
||||
re->Vertex3f( v[0], v[1], v[2] );
|
||||
pglVertex3fv( v );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3062,8 +3030,7 @@ TriVertex3f
|
|||
*/
|
||||
void TriVertex3f( float x, float y, float z )
|
||||
{
|
||||
if( !re ) return;
|
||||
re->Vertex3f( x, y, z );
|
||||
pglVertex3f( x, y, z );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3077,7 +3044,7 @@ void TriBrightness( float brightness )
|
|||
int color;
|
||||
|
||||
color = brightness * 255;
|
||||
re->Color4ub( color, color, color, 255 );
|
||||
pglColor4ub( color, color, color, 255 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3088,8 +3055,16 @@ TriCullFace
|
|||
*/
|
||||
void TriCullFace( TRICULLSTYLE mode )
|
||||
{
|
||||
if( !re ) return;
|
||||
re->CullFace( mode );
|
||||
switch( mode )
|
||||
{
|
||||
case TRI_FRONT:
|
||||
mode = GL_FRONT;
|
||||
break;
|
||||
default:
|
||||
mode = GL_NONE;
|
||||
break;
|
||||
}
|
||||
GL_Cull( mode );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3101,18 +3076,12 @@ bind current texture
|
|||
*/
|
||||
int TriSpriteTexture( model_t *pSpriteModel, int frame )
|
||||
{
|
||||
shader_t shader;
|
||||
int gl_texturenum;
|
||||
|
||||
if( !re || !pSpriteModel )
|
||||
if(( gl_texturenum = R_GetSpriteTexture( pSpriteModel, frame )) == 0 )
|
||||
return 0;
|
||||
|
||||
if( !pSpriteModel->mempool )
|
||||
shader = pSpriteModel->firstmodelsurface;
|
||||
else if( pSpriteModel->type == mod_sprite && pSpriteModel->numframes )
|
||||
shader = re->GetSpriteTexture( CM_ClipModelToHandle( pSpriteModel ), frame );
|
||||
else return 0;
|
||||
|
||||
re->Bind( shader, frame );
|
||||
GL_Bind( GL_TEXTURE0, gl_texturenum );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -3126,12 +3095,12 @@ convert world coordinates (x,y,z) into screen (x, y)
|
|||
*/
|
||||
int TriWorldToScreen( float *world, float *screen )
|
||||
{
|
||||
int retval = 0;
|
||||
int retval = 0;
|
||||
|
||||
if( !re || !world || !screen )
|
||||
if( !world || !screen )
|
||||
return retval;
|
||||
|
||||
retval = re->WorldToScreen( world, screen );
|
||||
retval = R_WorldToScreen( world, screen );
|
||||
|
||||
screen[0] = 0.5f * screen[0] * (float)cl.refdef.viewport[2];
|
||||
screen[1] = -0.5f * screen[1] * (float)cl.refdef.viewport[3];
|
||||
|
@ -3150,7 +3119,7 @@ enables global fog on the level
|
|||
*/
|
||||
void TriFog( float flFogColor[3], float flStart, float flEnd, int bOn )
|
||||
{
|
||||
if( re ) re->Fog( flFogColor, flStart, flEnd, bOn );
|
||||
// re->Fog( flFogColor, flStart, flEnd, bOn );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3162,34 +3131,9 @@ convert screen coordinates (x,y) into world (x, y, z)
|
|||
*/
|
||||
void TriScreenToWorld( float *screen, float *world )
|
||||
{
|
||||
if( !re ) return;
|
||||
re->ScreenToWorld( screen, world );
|
||||
R_ScreenToWorld( screen, world );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
TriNormal3fv
|
||||
|
||||
=============
|
||||
*/
|
||||
void TriNormal3fv( const float *v )
|
||||
{
|
||||
if( !re || !v ) return;
|
||||
re->Normal3f( v[0], v[1], v[2] );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
TriNormal3f
|
||||
|
||||
=============
|
||||
*/
|
||||
void TriNormal3f( float x, float y, float z )
|
||||
{
|
||||
if( !re ) return;
|
||||
re->Normal3f( x, y, z );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
DemoApi implementation
|
||||
|
@ -3425,7 +3369,7 @@ float Voice_GetControlFloat( VoiceTweakControl iControl )
|
|||
static triangleapi_t gTriApi =
|
||||
{
|
||||
TRI_API_VERSION,
|
||||
TriRenderMode,
|
||||
GL_SetRenderMode,
|
||||
TriBegin,
|
||||
TriEnd,
|
||||
TriColor4f,
|
||||
|
@ -3438,7 +3382,7 @@ static triangleapi_t gTriApi =
|
|||
TriSpriteTexture,
|
||||
TriWorldToScreen,
|
||||
TriFog,
|
||||
TriScreenToWorld,
|
||||
R_ScreenToWorld,
|
||||
};
|
||||
|
||||
static efx_api_t gEfxApi =
|
||||
|
|
|
@ -259,6 +259,7 @@ usercmd_t CL_CreateCmd( void )
|
|||
{
|
||||
usercmd_t cmd;
|
||||
static double extramsec = 0;
|
||||
vec3_t color;
|
||||
int ms;
|
||||
|
||||
// send milliseconds of time to apply the move
|
||||
|
@ -290,13 +291,8 @@ usercmd_t CL_CreateCmd( void )
|
|||
|
||||
clgame.dllFuncs.CL_CreateMove( cl.time - cl.oldtime, &cmd, ( cls.state == ca_active && !cl.refdef.paused ));
|
||||
|
||||
if( re )
|
||||
{
|
||||
vec3_t color;
|
||||
|
||||
re->LightForPoint( cl.frame.local.client.origin, color );
|
||||
cmd.lightlevel = VectorAvg( color ) * 255;
|
||||
}
|
||||
R_LightForPoint( cl.frame.local.client.origin, color );
|
||||
cmd.lightlevel = VectorAvg( color ) * 255;
|
||||
|
||||
// random seed for predictable random values
|
||||
cl.random_seed = Com_RandomLong( 0, 0x7fffffff ); // full range
|
||||
|
@ -844,7 +840,7 @@ void CL_Crashed_f( void )
|
|||
Host_WriteOpenGLConfig();
|
||||
Host_WriteConfig(); // write config
|
||||
|
||||
if( re ) re->RestoreGamma();
|
||||
VID_RestoreGamma();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1053,7 +1049,6 @@ void CL_PrepVideo( void )
|
|||
// let the render dll load the map
|
||||
com.strncpy( mapname, cl.model_precache[1], MAX_STRING );
|
||||
CM_BeginRegistration( mapname, true, &map_checksum );
|
||||
re->BeginRegistration( mapname );
|
||||
cl.worldmodel = CM_ClipHandleToModel( 1 ); // get world pointer
|
||||
|
||||
SCR_RegisterShaders(); // update with new sequence
|
||||
|
@ -1071,7 +1066,6 @@ void CL_PrepVideo( void )
|
|||
for( i = 0; i < MAX_MODELS && cl.model_precache[i+1][0]; i++ )
|
||||
{
|
||||
com.strncpy( name, cl.model_precache[i+1], MAX_STRING );
|
||||
re->RegisterModel( name, i+1 );
|
||||
CM_RegisterModel( name, i+1 );
|
||||
Cvar_SetFloat( "scr_loading", scr_loading->value + 45.0f / mdlcount );
|
||||
if( cl_allow_levelshots->integer || host.developer > 3 ) SCR_UpdateScreen();
|
||||
|
@ -1081,10 +1075,18 @@ void CL_PrepVideo( void )
|
|||
Mem_Set( cl.decal_index, 0, sizeof( cl.decal_index ));
|
||||
|
||||
// setup sky and free unneeded stuff
|
||||
re->EndRegistration( cl.refdef.movevars->skyName );
|
||||
R_SetupSky( cl.refdef.movevars->skyName );
|
||||
CM_EndRegistration (); // free unused models
|
||||
Cvar_SetFloat( "scr_loading", 100.0f ); // all done
|
||||
|
||||
// release unused SpriteTextures
|
||||
for( i = 1; i < MAX_IMAGES; i++ )
|
||||
{
|
||||
if( !clgame.sprites[i].name[0] ) continue; // free slot
|
||||
if( clgame.sprites[i].registration_sequence != cm.registration_sequence )
|
||||
Mod_UnloadSpriteModel( &clgame.sprites[i] );
|
||||
}
|
||||
|
||||
if( host.decalList )
|
||||
{
|
||||
// need to reapply all decals after restarting
|
||||
|
|
|
@ -158,7 +158,7 @@ static void UI_DrawLogo( const char *filename, float x, float y, float width, fl
|
|||
redraw = true;
|
||||
}
|
||||
|
||||
re->DrawStretchRaw( x, y, width, height, menu.logo_xres, menu.logo_yres, cin_data, redraw );
|
||||
R_DrawStretchRaw( x, y, width, height, menu.logo_xres, menu.logo_yres, cin_data, redraw );
|
||||
}
|
||||
|
||||
static int UI_GetLogoWidth( void )
|
||||
|
@ -249,18 +249,16 @@ PIC_DrawGeneric
|
|||
draw hudsprite routine
|
||||
====================
|
||||
*/
|
||||
static void PIC_DrawGeneric( int frame, float x, float y, float width, float height, const wrect_t *prc )
|
||||
static void PIC_DrawGeneric( float x, float y, float width, float height, const wrect_t *prc )
|
||||
{
|
||||
float s1, s2, t1, t2;
|
||||
|
||||
if( !re ) return;
|
||||
|
||||
if( width == -1 && height == -1 )
|
||||
{
|
||||
int w, h;
|
||||
|
||||
// assume we get sizes from image
|
||||
re->GetParms( &w, &h, NULL, frame, menu.ds.hSprite );
|
||||
R_GetTextureParms( &w, &h, menu.ds.gl_texturenum );
|
||||
|
||||
width = w;
|
||||
height = h;
|
||||
|
@ -286,8 +284,8 @@ static void PIC_DrawGeneric( int frame, float x, float y, float width, float hei
|
|||
if( menu.ds.scissor_test && !PIC_Scissor( &x, &y, &width, &height, &s1, &t1, &s2, &t2 ))
|
||||
return;
|
||||
|
||||
re->DrawStretchPic( x, y, width, height, s1, t1, s2, t2, menu.ds.hSprite );
|
||||
re->SetColor( NULL );
|
||||
R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, menu.ds.gl_texturenum );
|
||||
R_DrawSetColor( NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -304,16 +302,12 @@ pfnPIC_Load
|
|||
*/
|
||||
static HIMAGE pfnPIC_Load( const char *szPicName, const byte *image_buf, long image_size )
|
||||
{
|
||||
if( !re ) return 0; // render not initialized
|
||||
if( !szPicName || !*szPicName )
|
||||
{
|
||||
MsgDev( D_ERROR, "CL_LoadImage: bad name!\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( image_buf && image_size > 0 )
|
||||
return re->RegisterShaderInt( szPicName, image_buf, image_size );
|
||||
return re->RegisterShader( szPicName, SHADER_NOMIP );
|
||||
return GL_LoadTexture( szPicName, image_buf, image_size, TF_IMAGE );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -324,39 +318,7 @@ pfnPIC_Free
|
|||
*/
|
||||
static void pfnPIC_Free( const char *szPicName )
|
||||
{
|
||||
if( re ) re->FreeShader( szPicName );
|
||||
}
|
||||
|
||||
/*
|
||||
=========
|
||||
pfnPIC_Frames
|
||||
|
||||
=========
|
||||
*/
|
||||
static int pfnPIC_Frames( HIMAGE hPic )
|
||||
{
|
||||
int numFrames;
|
||||
|
||||
if( !re ) return 1;
|
||||
re->GetParms( NULL, NULL, &numFrames, 0, hPic );
|
||||
|
||||
return numFrames;
|
||||
}
|
||||
|
||||
/*
|
||||
=========
|
||||
pfnPIC_Height
|
||||
|
||||
=========
|
||||
*/
|
||||
static int pfnPIC_Height( HIMAGE hPic, int frame )
|
||||
{
|
||||
int picHeight;
|
||||
|
||||
if( !re ) return 0;
|
||||
re->GetParms( NULL, &picHeight, NULL, frame, hPic );
|
||||
|
||||
return picHeight;
|
||||
GL_FreeImage( szPicName );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -365,31 +327,43 @@ pfnPIC_Width
|
|||
|
||||
=========
|
||||
*/
|
||||
static int pfnPIC_Width( HIMAGE hPic, int frame )
|
||||
static int pfnPIC_Width( HIMAGE hPic )
|
||||
{
|
||||
int picWidth;
|
||||
|
||||
if( !re ) return 0;
|
||||
re->GetParms( &picWidth, NULL, NULL, frame, hPic );
|
||||
R_GetTextureParms( &picWidth, NULL, hPic );
|
||||
|
||||
return picWidth;
|
||||
}
|
||||
|
||||
/*
|
||||
=========
|
||||
pfnPIC_Height
|
||||
|
||||
=========
|
||||
*/
|
||||
static int pfnPIC_Height( HIMAGE hPic )
|
||||
{
|
||||
int picHeight;
|
||||
|
||||
R_GetTextureParms( NULL, &picHeight, hPic );
|
||||
|
||||
return picHeight;
|
||||
}
|
||||
|
||||
/*
|
||||
=========
|
||||
pfnPIC_Set
|
||||
|
||||
=========
|
||||
*/
|
||||
static void pfnPIC_Set( HIMAGE hPic, int r, int g, int b, int a )
|
||||
void pfnPIC_Set( HIMAGE hPic, int r, int g, int b, int a )
|
||||
{
|
||||
rgba_t color;
|
||||
|
||||
if( !re ) return; // render not initialized
|
||||
|
||||
menu.ds.hSprite = hPic;
|
||||
menu.ds.gl_texturenum = hPic;
|
||||
MakeRGBA( color, r, g, b, a );
|
||||
re->SetColor( color );
|
||||
R_DrawSetColor( color );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -398,12 +372,10 @@ pfnPIC_Draw
|
|||
|
||||
=========
|
||||
*/
|
||||
static void pfnPIC_Draw( int frame, int x, int y, int width, int height, const wrect_t *prc )
|
||||
void pfnPIC_Draw( int x, int y, int width, int height, const wrect_t *prc )
|
||||
{
|
||||
if( !re ) return; // render not initialized
|
||||
|
||||
re->SetParms( menu.ds.hSprite, kRenderNormal, frame );
|
||||
PIC_DrawGeneric( frame, x, y, width, height, prc );
|
||||
GL_SetRenderMode( kRenderNormal );
|
||||
PIC_DrawGeneric( x, y, width, height, prc );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -412,12 +384,10 @@ pfnPIC_DrawTrans
|
|||
|
||||
=========
|
||||
*/
|
||||
static void pfnPIC_DrawTrans( int frame, int x, int y, int width, int height, const wrect_t *prc )
|
||||
void pfnPIC_DrawTrans( int x, int y, int width, int height, const wrect_t *prc )
|
||||
{
|
||||
if( !re ) return; // render not initialized
|
||||
|
||||
re->SetParms( menu.ds.hSprite, kRenderTransTexture, frame );
|
||||
PIC_DrawGeneric( frame, x, y, width, height, prc );
|
||||
GL_SetRenderMode( kRenderTransTexture );
|
||||
PIC_DrawGeneric( x, y, width, height, prc );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -426,12 +396,10 @@ pfnPIC_DrawHoles
|
|||
|
||||
=========
|
||||
*/
|
||||
static void pfnPIC_DrawHoles( int frame, int x, int y, int width, int height, const wrect_t *prc )
|
||||
void pfnPIC_DrawHoles( int x, int y, int width, int height, const wrect_t *prc )
|
||||
{
|
||||
if( !re ) return; // render not initialized
|
||||
|
||||
re->SetParms( menu.ds.hSprite, kRenderTransAlpha, frame );
|
||||
PIC_DrawGeneric( frame, x, y, width, height, prc );
|
||||
GL_SetRenderMode( kRenderTransAlpha );
|
||||
PIC_DrawGeneric( x, y, width, height, prc );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -440,12 +408,10 @@ pfnPIC_DrawAdditive
|
|||
|
||||
=========
|
||||
*/
|
||||
static void pfnPIC_DrawAdditive( int frame, int x, int y, int width, int height, const wrect_t *prc )
|
||||
void pfnPIC_DrawAdditive( int x, int y, int width, int height, const wrect_t *prc )
|
||||
{
|
||||
if( !re ) return; // render not initialized
|
||||
|
||||
re->SetParms( menu.ds.hSprite, kRenderTransAdd, frame );
|
||||
PIC_DrawGeneric( frame, x, y, width, height, prc );
|
||||
GL_SetRenderMode( kRenderTransAdd );
|
||||
PIC_DrawGeneric( x, y, width, height, prc );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -494,13 +460,11 @@ static void pfnFillRGBA( int x, int y, int width, int height, int r, int g, int
|
|||
{
|
||||
rgba_t color;
|
||||
|
||||
if( !re ) return;
|
||||
|
||||
MakeRGBA( color, r, g, b, a );
|
||||
re->SetColor( color );
|
||||
re->SetParms( cls.fillShader, kRenderTransTexture, 0 );
|
||||
re->DrawStretchPic( x, y, width, height, 0, 0, 1, 1, cls.fillShader );
|
||||
re->SetColor( NULL );
|
||||
R_DrawSetColor( color );
|
||||
GL_SetRenderMode( kRenderTransTexture );
|
||||
R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, cls.fillImage );
|
||||
R_DrawSetColor( NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -547,22 +511,22 @@ static void pfnDrawCharacter( int x, int y, int width, int height, int ch, int u
|
|||
|
||||
ch &= 255;
|
||||
|
||||
if( ch == ' ') return;
|
||||
if( ch == ' ' ) return;
|
||||
if( y < -height ) return;
|
||||
|
||||
color[3] = (ulRGBA & 0xFF000000) >> 24;
|
||||
color[0] = (ulRGBA & 0xFF0000) >> 16;
|
||||
color[1] = (ulRGBA & 0xFF00) >> 8;
|
||||
color[2] = (ulRGBA & 0xFF) >> 0;
|
||||
re->SetColor( color );
|
||||
R_DrawSetColor( color );
|
||||
|
||||
col = (ch & 15) * 0.0625 + (0.5f / 256.0f);
|
||||
row = (ch >> 4) * 0.0625 + (0.5f / 256.0f);
|
||||
size = 0.0625f - (1.0f / 256.0f);
|
||||
|
||||
re->SetParms( cls.creditsFont.hFontTexture, kRenderTransTexture, 0 );
|
||||
re->DrawStretchPic( x, y, width, height, col, row, col + size, row + size, hFont );
|
||||
re->SetColor( NULL );
|
||||
GL_SetRenderMode( kRenderTransTexture );
|
||||
R_DrawStretchPic( x, y, width, height, col, row, col + size, row + size, hFont );
|
||||
R_DrawSetColor( NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -620,7 +584,7 @@ for drawing playermodel previews
|
|||
*/
|
||||
static void pfnSetPlayerModel( cl_entity_t *ent, const char *path )
|
||||
{
|
||||
re->RegisterModel( path, MAX_MODELS - 1 );
|
||||
CM_RegisterModel( path, MAX_MODELS - 1 );
|
||||
ent->curstate.modelindex = MAX_MODELS - 1;
|
||||
}
|
||||
|
||||
|
@ -633,9 +597,10 @@ for drawing playermodel previews
|
|||
*/
|
||||
static void pfnRenderScene( const ref_params_t *fd )
|
||||
{
|
||||
if( !re || !fd ) return;
|
||||
if( fd->fov_x <= 0.0f || fd->fov_y <= 0.0f ) return;
|
||||
re->RenderFrame( fd, false );
|
||||
if( !fd || fd->fov_x <= 0.0f || fd->fov_y <= 0.0f )
|
||||
return;
|
||||
|
||||
R_RenderFrame( fd, false );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -755,9 +720,10 @@ retuns list of valid video renderers
|
|||
*/
|
||||
static char **pfnGetVideoList( int *numRenders )
|
||||
{
|
||||
if( numRenders )
|
||||
*numRenders = host.num_video_dlls;
|
||||
return host.video_dlls;
|
||||
static const char *vidlib = "default";
|
||||
|
||||
if( numRenders ) *numRenders = 1;
|
||||
return &(char *)vidlib;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -832,21 +798,6 @@ static void pfnChangeInstance( const char *newInstance, const char *szFinalMessa
|
|||
Sys_NewInstance( newInstance, szFinalMessage );
|
||||
}
|
||||
|
||||
/*
|
||||
=========
|
||||
pfnChangeVideo
|
||||
|
||||
=========
|
||||
*/
|
||||
static void pfnChangeVideo( const char *dllName )
|
||||
{
|
||||
if( !dllName || !*dllName ) return;
|
||||
|
||||
// video subsystem will be automatically restarted on nextframe
|
||||
Cvar_FullSet( "host_video", dllName, CVAR_INIT|CVAR_ARCHIVE );
|
||||
Cbuf_ExecuteText( EXEC_APPEND, "vid_restart\n" );
|
||||
}
|
||||
|
||||
/*
|
||||
=========
|
||||
pfnHostNewGame
|
||||
|
@ -876,9 +827,8 @@ static ui_enginefuncs_t gEngfuncs =
|
|||
{
|
||||
pfnPIC_Load,
|
||||
pfnPIC_Free,
|
||||
pfnPIC_Frames,
|
||||
pfnPIC_Height,
|
||||
pfnPIC_Width,
|
||||
pfnPIC_Height,
|
||||
pfnPIC_Set,
|
||||
pfnPIC_Draw,
|
||||
pfnPIC_DrawHoles,
|
||||
|
@ -950,7 +900,6 @@ static ui_enginefuncs_t gEngfuncs =
|
|||
pfnShellExecute,
|
||||
Host_WriteServerConfig,
|
||||
pfnChangeInstance,
|
||||
pfnChangeVideo,
|
||||
S_StartBackgroundTrack,
|
||||
pfnHostEndGame,
|
||||
};
|
||||
|
|
|
@ -400,7 +400,7 @@ void CL_ParseMovevars( sizebuf_t *msg )
|
|||
|
||||
// update sky if changed
|
||||
if( com.strcmp( clgame.oldmovevars.skyName, clgame.movevars.skyName ) && cl.video_prepped )
|
||||
re->RegisterShader( clgame.movevars.skyName, SHADER_SKY );
|
||||
R_SetupSky( clgame.movevars.skyName );
|
||||
|
||||
Mem_Copy( &clgame.oldmovevars, &clgame.movevars, sizeof( movevars_t ));
|
||||
clgame.entities->curstate.scale = clgame.movevars.waveHeight;
|
||||
|
@ -491,7 +491,7 @@ void CL_ParseStaticDecal( sizebuf_t *msg )
|
|||
flags = BF_ReadByte( msg );
|
||||
|
||||
if( !cl.decal_index[decalIndex] )
|
||||
cl.decal_index[decalIndex] = re->RegisterShader( host.draw_decals[decalIndex], SHADER_DECAL );
|
||||
cl.decal_index[decalIndex] = GL_LoadTexture( host.draw_decals[decalIndex], NULL, 0, TF_DECAL );
|
||||
|
||||
CL_DecalShoot( cl.decal_index[decalIndex], entityIndex, modelIndex, origin, flags );
|
||||
}
|
||||
|
@ -862,7 +862,6 @@ void CL_PrecacheModel( sizebuf_t *msg )
|
|||
// when we loading map all resources is precached sequentially
|
||||
if( !cl.video_prepped ) return;
|
||||
|
||||
re->RegisterModel( cl.model_precache[modelIndex], modelIndex );
|
||||
CM_RegisterModel( cl.model_precache[modelIndex], modelIndex );
|
||||
}
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ void SCR_RSpeeds( void )
|
|||
{
|
||||
char msg[MAX_SYSPATH];
|
||||
|
||||
if( re->RSpeedsMessage( msg, sizeof( msg )))
|
||||
if( R_SpeedsMessage( msg, sizeof( msg )))
|
||||
{
|
||||
int x, y, height;
|
||||
char *p, *start, *end;
|
||||
|
@ -176,23 +176,23 @@ void SCR_MakeScreenShot( void )
|
|||
{
|
||||
qboolean iRet = false;
|
||||
|
||||
if( !re && host.type == HOST_NORMAL )
|
||||
if( host.type == HOST_NORMAL )
|
||||
return; // don't reset action - it will be wait until render initalization is done
|
||||
|
||||
switch( cls.scrshot_action )
|
||||
{
|
||||
case scrshot_plaque:
|
||||
iRet = re->ScrShot( cls.shotname, VID_LEVELSHOT );
|
||||
iRet = VID_ScreenShot( cls.shotname, VID_LEVELSHOT );
|
||||
break;
|
||||
case scrshot_savegame:
|
||||
case scrshot_demoshot:
|
||||
iRet = re->ScrShot( cls.shotname, VID_MINISHOT );
|
||||
iRet = VID_ScreenShot( cls.shotname, VID_MINISHOT );
|
||||
break;
|
||||
case scrshot_envshot:
|
||||
iRet = re->EnvShot( cls.shotname, cl_envshot_size->integer, cls.envshot_vieworg, false );
|
||||
iRet = VID_CubemapShot( cls.shotname, cl_envshot_size->integer, cls.envshot_vieworg, false );
|
||||
break;
|
||||
case scrshot_skyshot:
|
||||
iRet = re->EnvShot( cls.shotname, cl_envshot_size->integer, cls.envshot_vieworg, true );
|
||||
iRet = VID_CubemapShot( cls.shotname, cl_envshot_size->integer, cls.envshot_vieworg, true );
|
||||
break;
|
||||
default: return; // does nothing
|
||||
}
|
||||
|
@ -210,13 +210,11 @@ void SCR_DrawPlaque( void )
|
|||
{
|
||||
shader_t levelshot;
|
||||
|
||||
if( !re ) return;
|
||||
|
||||
if( cl_allow_levelshots->integer && !cls.changelevel )
|
||||
{
|
||||
levelshot = re->RegisterShader( cl_levelshot_name->string, SHADER_NOMIP );
|
||||
re->SetParms( levelshot, kRenderNormal, 0 );
|
||||
re->DrawStretchPic( 0, 0, scr_width->integer, scr_height->integer, 0, 0, 1, 1, levelshot );
|
||||
levelshot = GL_LoadTexture( cl_levelshot_name->string, NULL, 0, TF_IMAGE );
|
||||
GL_SetRenderMode( kRenderNormal );
|
||||
R_DrawStretchPic( 0, 0, scr_width->integer, scr_height->integer, 0, 0, 1, 1, levelshot );
|
||||
|
||||
CL_DrawHUD( CL_LOADING );
|
||||
}
|
||||
|
@ -266,8 +264,6 @@ void SCR_UpdateScreen( void )
|
|||
|
||||
static void SCR_LoadCreditsFont( void )
|
||||
{
|
||||
if( !re ) return;
|
||||
|
||||
// setup creditsfont
|
||||
if( FS_FileExists( "gfx/creditsfont.fnt" ))
|
||||
{
|
||||
|
@ -278,7 +274,7 @@ static void SCR_LoadCreditsFont( void )
|
|||
|
||||
// half-life font with variable chars witdh
|
||||
buffer = FS_LoadFile( "gfx/creditsfont.fnt", &length );
|
||||
re->GetParms( &fontWidth, NULL, NULL, 0, cls.creditsFont.hFontTexture );
|
||||
R_GetTextureParms( &fontWidth, NULL, cls.creditsFont.hFontTexture );
|
||||
|
||||
if( buffer && length >= sizeof( qfont_t ))
|
||||
{
|
||||
|
@ -334,19 +330,13 @@ static void SCR_InstallParticlePalette( void )
|
|||
|
||||
void SCR_RegisterShaders( void )
|
||||
{
|
||||
if( !re ) return;
|
||||
|
||||
cls.fillShader = re->RegisterShader( "*white", SHADER_NOMIP ); // used for FillRGBA
|
||||
cls.particleShader = re->RegisterShader( "*particle", SHADER_NOMIP );
|
||||
cls.fillImage = GL_LoadTexture( "*white", NULL, 0, TF_IMAGE ); // used for FillRGBA
|
||||
cls.particleImage = GL_LoadTexture( "*particle", NULL, 0, TF_IMAGE );
|
||||
|
||||
// register gfx.wad images
|
||||
cls.pauseIcon = re->RegisterShader( "gfx/paused", SHADER_NOMIP );
|
||||
cls.loadingBar = re->RegisterShader( "gfx/lambda", SHADER_NOMIP );
|
||||
cls.creditsFont.hFontTexture = re->RegisterShader( "gfx/creditsfont", SHADER_NOMIP );
|
||||
|
||||
// FIXME: register new type shader 'GLOWSHELL', allow to loading sprites with this type
|
||||
// apply by default 'deformVertices' etc
|
||||
cls.glowShell = re->RegisterShader( "renderfx/glowshell", SHADER_GENERIC );
|
||||
cls.pauseIcon = GL_LoadTexture( "gfx.wad/paused", NULL, 0, TF_IMAGE );
|
||||
cls.loadingBar = GL_LoadTexture( "gfx.wad/lambda", NULL, 0, TF_IMAGE|TF_LUMINANCE );
|
||||
cls.creditsFont.hFontTexture = GL_LoadTexture( "gfx.wad/creditsfont", NULL, 0, TF_IMAGE );
|
||||
cls.hChromeSprite = pfnSPR_Load( "sprites/shellchrome.spr" );
|
||||
}
|
||||
|
||||
|
|
|
@ -98,9 +98,9 @@ pfnGetChromeSprite
|
|||
*/
|
||||
static model_t *pfnGetChromeSprite( void )
|
||||
{
|
||||
if( cls.hChromeSprite <= 0 || cls.hChromeSprite > MAX_IMAGES )
|
||||
if( cls.hChromeSprite <= 0 || cls.hChromeSprite > ( MAX_IMAGES - 1 ))
|
||||
return NULL; // bad sprite
|
||||
return &clgame.ds.images[cls.hChromeSprite];
|
||||
return &clgame.sprites[cls.hChromeSprite];
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -222,8 +222,6 @@ int CL_TEntAddEntity( cl_entity_t *pEntity )
|
|||
float shellScale = 1.0f;
|
||||
int result;
|
||||
|
||||
if( !re ) return false;
|
||||
|
||||
ASSERT( pEntity != NULL );
|
||||
|
||||
if( pEntity->curstate.renderfx == kRenderFxGlowShell )
|
||||
|
@ -234,7 +232,7 @@ int CL_TEntAddEntity( cl_entity_t *pEntity )
|
|||
pEntity->curstate.renderamt = 255; // clear amount
|
||||
}
|
||||
|
||||
result = re->AddRefEntity( pEntity, ET_TEMPENTITY, -1 );
|
||||
result = R_AddEntity( pEntity, ET_TEMPENTITY, -1 );
|
||||
|
||||
if( pEntity->curstate.renderfx == kRenderFxGlowShell )
|
||||
{
|
||||
|
@ -243,7 +241,7 @@ int CL_TEntAddEntity( cl_entity_t *pEntity )
|
|||
pEntity->curstate.renderamt = 128;
|
||||
|
||||
// render glowshell
|
||||
result |= re->AddRefEntity( pEntity, ET_TEMPENTITY, cls.glowShell );
|
||||
result |= R_AddEntity( pEntity, ET_TEMPENTITY, cls.glowShell );
|
||||
|
||||
// restore parms
|
||||
pEntity->curstate.scale = oldScale;
|
||||
|
@ -2199,7 +2197,7 @@ void CL_AddLightStyles( void )
|
|||
lightstyle_t *ls;
|
||||
|
||||
for( i = 0, ls = cl.lightstyles; i < MAX_LIGHTSTYLES; i++, ls++ )
|
||||
re->AddLightStyle( i, ls->rgb );
|
||||
R_SetLightStyle( i, ls->rgb );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2297,7 +2295,7 @@ qboolean CL_AddDlight( dlight_t *dl )
|
|||
if( dl->dark ) flags |= DLIGHT_DARK;
|
||||
if( dl->elight ) flags |= DLIGHT_ONLYENTS;
|
||||
|
||||
add = re->AddDLight( dl->origin, dl->color, dl->radius, flags );
|
||||
add = R_AddDLight( dl->origin, dl->color, dl->radius, flags );
|
||||
|
||||
return add;
|
||||
}
|
||||
|
@ -2450,7 +2448,7 @@ void CL_DecalShoot( HSPRITE hDecal, int entityIndex, int modelIndex, float *pos,
|
|||
rgba_t color;
|
||||
|
||||
Vector4Set( color, 255, 255, 255, 255 ); // don't use custom colors
|
||||
if( re ) re->DecalShoot( hDecal, entityIndex, modelIndex, pos, NULL, flags, color, 0.0f, 0.0f );
|
||||
R_DecalShoot( hDecal, entityIndex, modelIndex, pos, NULL, flags, color );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2470,7 +2468,7 @@ void CL_PlayerDecal( HSPRITE hDecal, int entityIndex, float *pos, byte *color )
|
|||
if( pEnt ) modelIndex = pEnt->curstate.modelindex;
|
||||
if( !color ) color = _clr;
|
||||
|
||||
if( re ) re->DecalShoot( hDecal, entityIndex, modelIndex, pos, NULL, FDECAL_CUSTOM, color, 0.0f, 0.0f );
|
||||
R_DecalShoot( hDecal, entityIndex, modelIndex, pos, NULL, FDECAL_CUSTOM, color );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2508,9 +2506,8 @@ int CL_DecalIndex( int id )
|
|||
id = bound( 0, id, MAX_DECALS - 1 );
|
||||
|
||||
if( !cl.decal_index[id] )
|
||||
{
|
||||
cl.decal_index[id] = re->RegisterShader( host.draw_decals[id], SHADER_DECAL );
|
||||
}
|
||||
cl.decal_index[id] = GL_LoadTexture( host.draw_decals[id], NULL, 0, TF_DECAL );
|
||||
|
||||
return cl.decal_index[id];
|
||||
}
|
||||
|
||||
|
@ -2524,20 +2521,7 @@ remove all decals with specified shader
|
|||
void CL_DecalRemoveAll( int textureIndex )
|
||||
{
|
||||
int id = bound( 0, textureIndex, MAX_DECALS - 1 );
|
||||
re->DecalRemoveAll( cl.decal_index[id] );
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
CL_LightForPoint
|
||||
|
||||
get lighting color for specified point
|
||||
===============
|
||||
*/
|
||||
void CL_LightForPoint( const vec3_t point, vec3_t ambientLight )
|
||||
{
|
||||
if( re ) re->LightForPoint( point, ambientLight );
|
||||
else VectorClear( ambientLight );
|
||||
R_DecalRemoveAll( cl.decal_index[id] );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -170,7 +170,7 @@ qboolean SCR_DrawCinematic( void )
|
|||
qboolean redraw = false;
|
||||
byte *frame = NULL;
|
||||
|
||||
if( !re || cin_time <= 0.0f )
|
||||
if( cin_time <= 0.0f )
|
||||
return false;
|
||||
|
||||
if( cin_frame != last_frame )
|
||||
|
@ -180,7 +180,7 @@ qboolean SCR_DrawCinematic( void )
|
|||
redraw = true;
|
||||
}
|
||||
|
||||
re->DrawStretchRaw( 0, 0, scr_width->integer, scr_height->integer, xres, yres, frame, redraw );
|
||||
R_DrawStretchRaw( 0, 0, scr_width->integer, scr_height->integer, xres, yres, frame, redraw );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "client.h"
|
||||
#include "const.h"
|
||||
#include "entity_types.h"
|
||||
#include "gl_local.h"
|
||||
|
||||
/*
|
||||
====================
|
||||
|
@ -17,7 +18,7 @@ Specifies the model that will be used as the world
|
|||
*/
|
||||
void V_ClearScene( void )
|
||||
{
|
||||
if( re ) re->ClearScene();
|
||||
R_ClearScene();
|
||||
}
|
||||
|
||||
float V_CalcFov( float fov_x, float width, float height )
|
||||
|
@ -126,7 +127,7 @@ void V_CalcRefDef( void )
|
|||
{
|
||||
clgame.dllFuncs.pfnCalcRefdef( &cl.refdef );
|
||||
V_AddViewModel();
|
||||
re->RenderFrame( &cl.refdef, true );
|
||||
R_RenderFrame( &cl.refdef, true );
|
||||
} while( cl.refdef.nextView );
|
||||
}
|
||||
|
||||
|
@ -166,7 +167,8 @@ qboolean V_PreRender( void )
|
|||
static qboolean oldState;
|
||||
|
||||
// too early
|
||||
if( !re ) return false;
|
||||
if( !glw_state.initialized )
|
||||
return false;
|
||||
|
||||
if( host.state == HOST_NOFOCUS )
|
||||
return false;
|
||||
|
@ -176,13 +178,13 @@ qboolean V_PreRender( void )
|
|||
if( cl.refdef.paused || cls.changelevel )
|
||||
clearScene = false;
|
||||
|
||||
re->BeginFrame( clearScene );
|
||||
R_BeginFrame( clearScene );
|
||||
|
||||
if( !oldState && cls.changelevel )
|
||||
{
|
||||
// fire once
|
||||
CL_DrawHUD( CL_CHANGELEVEL );
|
||||
re->EndFrame();
|
||||
R_EndFrame();
|
||||
}
|
||||
oldState = cls.changelevel;
|
||||
|
||||
|
@ -210,5 +212,5 @@ void V_PostRender( void )
|
|||
}
|
||||
|
||||
SCR_MakeScreenShot();
|
||||
re->EndFrame();
|
||||
R_EndFrame();
|
||||
}
|
|
@ -22,7 +22,7 @@
|
|||
#define MAX_DEMOS 32
|
||||
#define MAX_MOVIES 8
|
||||
#define MAX_CDTRACKS 32
|
||||
#define MAX_IMAGES 256 // HSPRITE pics
|
||||
#define MAX_IMAGES 256 // SpriteTextures
|
||||
|
||||
#define EDICT_FROM_AREA( l ) STRUCT_FROM_LINK( l, cl_entity_t, area )
|
||||
#define NUM_FOR_EDICT(e) ((int)((cl_entity_t *)(e) - clgame.entities))
|
||||
|
@ -123,8 +123,8 @@ typedef struct
|
|||
char event_precache[MAX_EVENTS][CS_SIZE];
|
||||
lightstyle_t lightstyles[MAX_LIGHTSTYLES];
|
||||
|
||||
sound_t sound_index[MAX_SOUNDS];
|
||||
shader_t decal_index[MAX_DECALS];
|
||||
int sound_index[MAX_SOUNDS];
|
||||
int decal_index[MAX_DECALS];
|
||||
|
||||
model_t *worldmodel; // pointer to world
|
||||
} client_t;
|
||||
|
@ -200,17 +200,15 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
shader_t hFontTexture; // handle to texture shader
|
||||
int hFontTexture; // handle to texture
|
||||
wrect_t fontRc[256]; // rectangles
|
||||
qboolean valid; // rectangles are valid
|
||||
} cl_font_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
model_t images[MAX_IMAGES]; // conatin handle to spriteshader etc
|
||||
|
||||
// temp handle
|
||||
shader_t hSprite;
|
||||
const model_t *pSprite; // pointer to current SpriteTexture
|
||||
|
||||
// scissor test
|
||||
int scissor_x;
|
||||
|
@ -223,11 +221,26 @@ typedef struct
|
|||
rgba_t textColor;
|
||||
|
||||
// crosshair members
|
||||
shader_t hCrosshair;
|
||||
const model_t *pCrosshair;
|
||||
wrect_t rcCrosshair;
|
||||
rgba_t rgbaCrosshair;
|
||||
byte gammaTable[256];
|
||||
} draw_stuff_t;
|
||||
} client_draw_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int gl_texturenum; // this is a real texnum
|
||||
|
||||
// scissor test
|
||||
int scissor_x;
|
||||
int scissor_y;
|
||||
int scissor_width;
|
||||
int scissor_height;
|
||||
qboolean scissor_test;
|
||||
|
||||
// holds text color
|
||||
rgba_t textColor;
|
||||
} gameui_draw_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -325,7 +338,9 @@ typedef struct
|
|||
|
||||
string cdtracks[MAX_CDTRACKS]; // 32 cd-tracks read from cdaudio.txt
|
||||
|
||||
draw_stuff_t ds; // draw2d stuff (hud, weaponmenu etc)
|
||||
model_t sprites[MAX_IMAGES]; // client spritetextures
|
||||
|
||||
client_draw_t ds; // draw2d stuff (hud, weaponmenu etc)
|
||||
screenfade_t fade; // screen fade
|
||||
screen_shake_t shake; // screen shake
|
||||
center_print_t centerPrint; // centerprint variables
|
||||
|
@ -346,7 +361,7 @@ typedef struct
|
|||
|
||||
cl_entity_t playermodel; // uiPlayerSetup drawing model
|
||||
|
||||
draw_stuff_t ds; // draw2d stuff (hud, weaponmenu etc)
|
||||
gameui_draw_t ds; // draw2d stuff (menu images)
|
||||
GAMEINFO gameInfo; // current gameInfo
|
||||
GAMEINFO *modsInfo[MAX_MODS]; // simplified gameInfo for MainUI
|
||||
|
||||
|
@ -384,13 +399,13 @@ typedef struct
|
|||
float nextcmdtime; // when can we send the next command packet?
|
||||
int lastoutgoingcommand; // sequence number of last outgoing command
|
||||
|
||||
// internal shaders
|
||||
shader_t fillShader; // used for emulate FillRGBA to avoid wrong draw-sort
|
||||
shader_t particleShader; // built-in particle and sparks shader
|
||||
shader_t pauseIcon; // draw 'paused' when game in-pause
|
||||
shader_t loadingBar; // 'loading' progress bar
|
||||
shader_t glowShell; // for renderFxGlowShell
|
||||
HSPRITE hChromeSprite; // this is a really HudSprite handle, not shader_t!
|
||||
// internal images
|
||||
int fillImage; // used for emulate FillRGBA to avoid wrong draw-sort
|
||||
int particleImage; // built-in particle and sparks image
|
||||
int pauseIcon; // draw 'paused' when game in-pause
|
||||
int loadingBar; // 'loading' progress bar
|
||||
int glowShell; // for renderFxGlowShell
|
||||
HSPRITE hChromeSprite; // this is a really HudSprite handle, not texnum!
|
||||
cl_font_t creditsFont; // shared creditsfont
|
||||
|
||||
int num_client_entities; // cl.maxclients * CL_UPDATE_BACKUP * MAX_PACKET_ENTITIES
|
||||
|
@ -434,7 +449,6 @@ extern client_t cl;
|
|||
extern client_static_t cls;
|
||||
extern clgame_static_t clgame;
|
||||
extern menu_static_t menu;
|
||||
extern render_exp_t *re;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -612,7 +626,6 @@ int CL_AddEntity( int entityType, cl_entity_t *pEnt );
|
|||
void CL_WeaponAnim( int iAnim, int body );
|
||||
void CL_ClearEffects( void );
|
||||
void CL_TestLights( void );
|
||||
void CL_LightForPoint( const vec3_t point, vec3_t ambientLight );
|
||||
void CL_DecalShoot( HSPRITE hDecal, int entityIndex, int modelIndex, float *pos, int flags );
|
||||
void CL_PlayerDecal( HSPRITE hDecal, int entityIndex, float *pos, byte *color );
|
||||
void CL_QueueEvent( int flags, int index, float delay, event_args_t *args );
|
||||
|
@ -690,6 +703,11 @@ qboolean UI_CreditsActive( void );
|
|||
void UI_CharEvent( int key );
|
||||
qboolean UI_MouseInRect( void );
|
||||
qboolean UI_IsVisible( void );
|
||||
void pfnPIC_Set( HIMAGE hPic, int r, int g, int b, int a );
|
||||
void pfnPIC_Draw( int x, int y, int width, int height, const wrect_t *prc );
|
||||
void pfnPIC_DrawTrans( int x, int y, int width, int height, const wrect_t *prc );
|
||||
void pfnPIC_DrawHoles( int x, int y, int width, int height, const wrect_t *prc );
|
||||
void pfnPIC_DrawAdditive( int x, int y, int width, int height, const wrect_t *prc );
|
||||
|
||||
//
|
||||
// cl_video.c
|
||||
|
|
|
@ -131,6 +131,203 @@ void GL_FrontFace( GLenum front )
|
|||
glState.frontFace = front;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
GL_SetState
|
||||
=================
|
||||
*/
|
||||
void GL_SetState( int state )
|
||||
{
|
||||
int diff;
|
||||
|
||||
if( glState.in2DMode )
|
||||
state |= GLSTATE_NO_DEPTH_TEST;
|
||||
|
||||
if( state & GLSTATE_NO_DEPTH_TEST )
|
||||
state &= ~( GLSTATE_DEPTHWRITE|GLSTATE_DEPTHFUNC_EQ );
|
||||
|
||||
diff = glState.flags ^ state;
|
||||
if( !diff ) return;
|
||||
|
||||
if( diff & ( GLSTATE_BLEND_MTEX|GLSTATE_SRCBLEND_MASK|GLSTATE_DSTBLEND_MASK ))
|
||||
{
|
||||
if( state & ( GLSTATE_SRCBLEND_MASK|GLSTATE_DSTBLEND_MASK ))
|
||||
{
|
||||
int blendsrc, blenddst;
|
||||
|
||||
switch( state & GLSTATE_SRCBLEND_MASK )
|
||||
{
|
||||
case GLSTATE_SRCBLEND_ZERO:
|
||||
blendsrc = GL_ZERO;
|
||||
break;
|
||||
case GLSTATE_SRCBLEND_DST_COLOR:
|
||||
blendsrc = GL_DST_COLOR;
|
||||
break;
|
||||
case GLSTATE_SRCBLEND_ONE_MINUS_DST_COLOR:
|
||||
blendsrc = GL_ONE_MINUS_DST_COLOR;
|
||||
break;
|
||||
case GLSTATE_SRCBLEND_SRC_ALPHA:
|
||||
blendsrc = GL_SRC_ALPHA;
|
||||
break;
|
||||
case GLSTATE_SRCBLEND_ONE_MINUS_SRC_ALPHA:
|
||||
blendsrc = GL_ONE_MINUS_SRC_ALPHA;
|
||||
break;
|
||||
case GLSTATE_SRCBLEND_DST_ALPHA:
|
||||
blendsrc = GL_DST_ALPHA;
|
||||
break;
|
||||
case GLSTATE_SRCBLEND_ONE_MINUS_DST_ALPHA:
|
||||
blendsrc = GL_ONE_MINUS_DST_ALPHA;
|
||||
break;
|
||||
case GLSTATE_SRCBLEND_ONE:
|
||||
default:
|
||||
blendsrc = GL_ONE;
|
||||
break;
|
||||
}
|
||||
|
||||
switch( state & GLSTATE_DSTBLEND_MASK )
|
||||
{
|
||||
case GLSTATE_DSTBLEND_ONE:
|
||||
blenddst = GL_ONE;
|
||||
break;
|
||||
case GLSTATE_DSTBLEND_SRC_COLOR:
|
||||
blenddst = GL_SRC_COLOR;
|
||||
break;
|
||||
case GLSTATE_DSTBLEND_ONE_MINUS_SRC_COLOR:
|
||||
blenddst = GL_ONE_MINUS_SRC_COLOR;
|
||||
break;
|
||||
case GLSTATE_DSTBLEND_SRC_ALPHA:
|
||||
blenddst = GL_SRC_ALPHA;
|
||||
break;
|
||||
case GLSTATE_DSTBLEND_ONE_MINUS_SRC_ALPHA:
|
||||
blenddst = GL_ONE_MINUS_SRC_ALPHA;
|
||||
break;
|
||||
case GLSTATE_DSTBLEND_DST_ALPHA:
|
||||
blenddst = GL_DST_ALPHA;
|
||||
break;
|
||||
case GLSTATE_DSTBLEND_ONE_MINUS_DST_ALPHA:
|
||||
blenddst = GL_ONE_MINUS_DST_ALPHA;
|
||||
break;
|
||||
case GLSTATE_DSTBLEND_ZERO:
|
||||
default:
|
||||
blenddst = GL_ZERO;
|
||||
break;
|
||||
}
|
||||
|
||||
if( state & GLSTATE_BLEND_MTEX )
|
||||
{
|
||||
if( glState.currentEnvModes[glState.activeTMU] != GL_REPLACE )
|
||||
pglEnable( GL_BLEND );
|
||||
else pglDisable( GL_BLEND );
|
||||
}
|
||||
else
|
||||
{
|
||||
pglEnable( GL_BLEND );
|
||||
}
|
||||
|
||||
pglBlendFunc( blendsrc, blenddst );
|
||||
}
|
||||
else
|
||||
{
|
||||
pglDisable( GL_BLEND );
|
||||
}
|
||||
}
|
||||
|
||||
if( diff & GLSTATE_ALPHAFUNC )
|
||||
{
|
||||
if( state & GLSTATE_ALPHAFUNC )
|
||||
{
|
||||
if(!( glState.flags & GLSTATE_ALPHAFUNC ))
|
||||
pglEnable( GL_ALPHA_TEST );
|
||||
|
||||
if( state & GLSTATE_AFUNC_GT0 )
|
||||
pglAlphaFunc( GL_GREATER, 0 );
|
||||
else if( state & GLSTATE_AFUNC_LT128 )
|
||||
pglAlphaFunc( GL_LESS, 0.5f );
|
||||
else pglAlphaFunc( GL_GEQUAL, 0.5f );
|
||||
}
|
||||
else
|
||||
{
|
||||
pglDisable( GL_ALPHA_TEST );
|
||||
}
|
||||
}
|
||||
|
||||
if( diff & GLSTATE_DEPTHFUNC_EQ )
|
||||
{
|
||||
if( state & GLSTATE_DEPTHFUNC_EQ )
|
||||
pglDepthFunc( GL_EQUAL );
|
||||
else pglDepthFunc( GL_LEQUAL );
|
||||
}
|
||||
|
||||
if( diff & GLSTATE_DEPTHWRITE )
|
||||
{
|
||||
if( state & GLSTATE_DEPTHWRITE )
|
||||
pglDepthMask( GL_TRUE );
|
||||
else pglDepthMask( GL_FALSE );
|
||||
}
|
||||
|
||||
if( diff & GLSTATE_NO_DEPTH_TEST )
|
||||
{
|
||||
if( state & GLSTATE_NO_DEPTH_TEST )
|
||||
pglDisable( GL_DEPTH_TEST );
|
||||
else pglEnable( GL_DEPTH_TEST );
|
||||
}
|
||||
|
||||
if( diff & GLSTATE_OFFSET_FILL )
|
||||
{
|
||||
if( state & GLSTATE_OFFSET_FILL )
|
||||
pglEnable( GL_POLYGON_OFFSET_FILL );
|
||||
else pglDisable( GL_POLYGON_OFFSET_FILL );
|
||||
}
|
||||
|
||||
glState.flags = state;
|
||||
}
|
||||
|
||||
void GL_SetRenderMode( int mode )
|
||||
{
|
||||
int state, texEnv;
|
||||
|
||||
if( mode == glState.draw_rendermode )
|
||||
return;
|
||||
|
||||
switch( mode )
|
||||
{
|
||||
case kRenderNormal:
|
||||
default:
|
||||
state = GLSTATE_DEPTHWRITE;
|
||||
texEnv = GL_REPLACE;
|
||||
break;
|
||||
case kRenderTransColor:
|
||||
state = GLSTATE_SRCBLEND_DST_COLOR|GLSTATE_DSTBLEND_SRC_COLOR|GLSTATE_DEPTHWRITE;
|
||||
texEnv = GL_MODULATE;
|
||||
break;
|
||||
case kRenderTransTexture:
|
||||
state = GLSTATE_SRCBLEND_SRC_ALPHA|GLSTATE_DSTBLEND_ONE_MINUS_SRC_ALPHA|GLSTATE_DEPTHWRITE;
|
||||
texEnv = GL_MODULATE;
|
||||
break;
|
||||
case kRenderTransAlpha:
|
||||
state = GLSTATE_AFUNC_GE128|GLSTATE_DEPTHWRITE;
|
||||
texEnv = GL_MODULATE;
|
||||
break;
|
||||
case kRenderGlow:
|
||||
state = GLSTATE_SRCBLEND_SRC_ALPHA|GLSTATE_DSTBLEND_ONE;
|
||||
texEnv = GL_MODULATE;
|
||||
break;
|
||||
case kRenderTransAdd:
|
||||
state = GLSTATE_SRCBLEND_SRC_ALPHA|GLSTATE_DSTBLEND_ONE|GLSTATE_DEPTHWRITE;
|
||||
texEnv = GL_MODULATE;
|
||||
break;
|
||||
case kRenderTransInverse:
|
||||
state = GLSTATE_SRCBLEND_ONE_MINUS_SRC_ALPHA|GLSTATE_DSTBLEND_SRC_ALPHA|GLSTATE_DEPTHWRITE;
|
||||
texEnv = GL_MODULATE;
|
||||
break;
|
||||
}
|
||||
|
||||
GL_TexEnv( texEnv );
|
||||
GL_SetState( state );
|
||||
|
||||
glState.draw_rendermode = mode;
|
||||
}
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//=======================================================================
|
||||
// Copyright XashXT Group 2009 ©
|
||||
// cl_beam.c - client-side beams
|
||||
// gl_beams.c - beams rendering
|
||||
//=======================================================================
|
||||
|
||||
#include "common.h"
|
||||
|
@ -12,6 +12,7 @@
|
|||
#include "customentity.h"
|
||||
#include "cl_tent.h"
|
||||
#include "pm_local.h"
|
||||
#include "gl_local.h"
|
||||
#include "studio.h"
|
||||
|
||||
#define NOISE_DIVISIONS 64 // don't touch - many tripmines cause the crash when it equal 128
|
||||
|
@ -172,7 +173,7 @@ static void CL_DrawSegs( int modelIndex, float frame, int rendermode, const vec3
|
|||
if( !cl_draw_beams->integer )
|
||||
return;
|
||||
|
||||
m_hSprite = re->GetSpriteTexture( modelIndex, frame );
|
||||
m_hSprite = R_GetSpriteTexture( CM_ClipHandleToModel( modelIndex ), frame );
|
||||
|
||||
if( !m_hSprite || segments < 2 )
|
||||
return;
|
||||
|
@ -239,9 +240,9 @@ static void CL_DrawSegs( int modelIndex, float frame, int rendermode, const vec3
|
|||
segs_drawn = 0;
|
||||
total_segs = segments;
|
||||
|
||||
re->RenderMode( rendermode );
|
||||
re->Bind( m_hSprite, frame ); // GetSpriteTexture already set frame
|
||||
re->Begin( TRI_TRIANGLE_STRIP );
|
||||
GL_SetRenderMode( rendermode );
|
||||
GL_Bind( GL_TEXTURE0, m_hSprite );
|
||||
pglBegin( GL_TRIANGLE_STRIP );
|
||||
|
||||
// specify all the segments.
|
||||
for( i = 0; i < segments; i++ )
|
||||
|
@ -332,15 +333,15 @@ static void CL_DrawSegs( int modelIndex, float frame, int rendermode, const vec3
|
|||
VectorMA( curSeg.pos, ( curSeg.width * 0.5f ), vAveNormal, vPoint1 );
|
||||
VectorMA( curSeg.pos, (-curSeg.width * 0.5f ), vAveNormal, vPoint2 );
|
||||
|
||||
TriColor4f( curSeg.color[0], curSeg.color[1], curSeg.color[2], curSeg.alpha );
|
||||
re->TexCoord2f( 0.0f, curSeg.texcoord );
|
||||
TriNormal3fv( vAveNormal );
|
||||
TriVertex3fv( vPoint1 );
|
||||
pglColor4f( curSeg.color[0], curSeg.color[1], curSeg.color[2], curSeg.alpha );
|
||||
pglTexCoord2f( 0.0f, curSeg.texcoord );
|
||||
pglNormal3fv( vAveNormal );
|
||||
pglVertex3fv( vPoint1 );
|
||||
|
||||
TriColor4f( curSeg.color[0], curSeg.color[1], curSeg.color[2], curSeg.alpha );
|
||||
re->TexCoord2f( 1.0f, curSeg.texcoord );
|
||||
TriNormal3fv( vAveNormal );
|
||||
TriVertex3fv( vPoint2 );
|
||||
pglColor4f( curSeg.color[0], curSeg.color[1], curSeg.color[2], curSeg.alpha );
|
||||
pglTexCoord2f( 1.0f, curSeg.texcoord );
|
||||
pglNormal3fv( vAveNormal );
|
||||
pglVertex3fv( vPoint2 );
|
||||
}
|
||||
|
||||
curSeg = nextSeg;
|
||||
|
@ -353,22 +354,22 @@ static void CL_DrawSegs( int modelIndex, float frame, int rendermode, const vec3
|
|||
VectorMA( curSeg.pos, (-curSeg.width * 0.5f ), vLastNormal, vPoint2 );
|
||||
|
||||
// specify the points.
|
||||
TriColor4f( curSeg.color[0], curSeg.color[1], curSeg.color[2], curSeg.alpha );
|
||||
re->TexCoord2f( 0.0f, curSeg.texcoord );
|
||||
TriNormal3fv( vLastNormal );
|
||||
TriVertex3fv( vPoint1 );
|
||||
pglColor4f( curSeg.color[0], curSeg.color[1], curSeg.color[2], curSeg.alpha );
|
||||
pglTexCoord2f( 0.0f, curSeg.texcoord );
|
||||
pglNormal3fv( vLastNormal );
|
||||
pglVertex3fv( vPoint1 );
|
||||
|
||||
TriColor4f( curSeg.color[0], curSeg.color[1], curSeg.color[2], curSeg.alpha );
|
||||
re->TexCoord2f( 1.0f, curSeg.texcoord );
|
||||
TriNormal3fv( vLastNormal );
|
||||
TriVertex3fv( vPoint2 );
|
||||
pglColor4f( curSeg.color[0], curSeg.color[1], curSeg.color[2], curSeg.alpha );
|
||||
pglTexCoord2f( 1.0f, curSeg.texcoord );
|
||||
pglNormal3fv( vLastNormal );
|
||||
pglVertex3fv( vPoint2 );
|
||||
}
|
||||
|
||||
vLast += vStep; // Advance texture scroll (v axis only)
|
||||
noiseIndex += noiseStep;
|
||||
}
|
||||
|
||||
re->End();
|
||||
pglEnd();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -383,10 +384,12 @@ static void CL_DrawDisk( int modelIndex, float frame, int rendermode, const vec3
|
|||
{
|
||||
float div, length, fraction;
|
||||
float w, vLast, vStep;
|
||||
HSPRITE m_hSprite = re->GetSpriteTexture( modelIndex, frame );
|
||||
HSPRITE m_hSprite;
|
||||
vec3_t point;
|
||||
int i;
|
||||
|
||||
m_hSprite = R_GetSpriteTexture( CM_ClipHandleToModel( modelIndex ), frame );
|
||||
|
||||
if( !m_hSprite || segments < 2 )
|
||||
return;
|
||||
|
||||
|
@ -408,10 +411,10 @@ static void CL_DrawDisk( int modelIndex, float frame, int rendermode, const vec3
|
|||
|
||||
w = freq * delta[2];
|
||||
|
||||
re->RenderMode( rendermode );
|
||||
re->Bind( m_hSprite, 0 ); // GetSpriteTexture already set frame
|
||||
GL_SetRenderMode( rendermode );
|
||||
GL_Bind( GL_TEXTURE0, m_hSprite );
|
||||
|
||||
re->Begin( TRI_TRIANGLE_STRIP );
|
||||
pglBegin( GL_TRIANGLE_STRIP );
|
||||
|
||||
// NOTE: We must force the degenerate triangles to be on the edge
|
||||
for( i = 0; i < segments; i++ )
|
||||
|
@ -421,23 +424,23 @@ static void CL_DrawDisk( int modelIndex, float frame, int rendermode, const vec3
|
|||
fraction = i * div;
|
||||
VectorCopy( source, point );
|
||||
|
||||
TriColor4f( color[0], color[1], color[2], 1.0f );
|
||||
re->TexCoord2f( 1.0f, vLast );
|
||||
TriVertex3fv( point );
|
||||
pglColor4f( color[0], color[1], color[2], 1.0f );
|
||||
pglTexCoord2f( 1.0f, vLast );
|
||||
pglVertex3fv( point );
|
||||
|
||||
com.sincos( fraction * 2.0f * M_PI, &s, &c );
|
||||
point[0] = s * w + source[0];
|
||||
point[1] = c * w + source[1];
|
||||
point[2] = source[2];
|
||||
|
||||
TriColor4f( color[0], color[1], color[2], 1.0f );
|
||||
re->TexCoord2f( 0.0f, vLast );
|
||||
TriVertex3fv( point );
|
||||
pglColor4f( color[0], color[1], color[2], 1.0f );
|
||||
pglTexCoord2f( 0.0f, vLast );
|
||||
pglVertex3fv( point );
|
||||
|
||||
vLast += vStep; // Advance texture scroll (v axis only)
|
||||
}
|
||||
|
||||
re->End();
|
||||
pglEnd();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -452,10 +455,12 @@ static void CL_DrawCylinder( int modelIndex, float frame, int rendermode, const
|
|||
{
|
||||
float length, fraction;
|
||||
float div, vLast, vStep;
|
||||
HSPRITE m_hSprite = re->GetSpriteTexture( modelIndex, frame );
|
||||
HSPRITE m_hSprite;
|
||||
vec3_t point;
|
||||
int i;
|
||||
|
||||
m_hSprite = R_GetSpriteTexture( CM_ClipHandleToModel( modelIndex ), frame );
|
||||
|
||||
if( !m_hSprite || segments < 2 )
|
||||
return;
|
||||
|
||||
|
@ -475,11 +480,11 @@ static void CL_DrawCylinder( int modelIndex, float frame, int rendermode, const
|
|||
vLast = fmod( freq * speed, 1.0f );
|
||||
scale = scale * length;
|
||||
|
||||
re->CullFace( TRI_NONE ); // FIXME: get it to work properly with enabled culling
|
||||
re->RenderMode( rendermode );
|
||||
re->Bind( m_hSprite, 0 ); // GetSpriteTexture already set frame
|
||||
GL_Cull( GL_NONE ); // FIXME: get it to work properly with enabled culling
|
||||
GL_SetRenderMode( rendermode );
|
||||
GL_Bind( GL_TEXTURE0, m_hSprite );
|
||||
|
||||
re->Begin( TRI_TRIANGLE_STRIP );
|
||||
pglBegin( GL_TRIANGLE_STRIP );
|
||||
|
||||
for( i = 0; i < segments; i++ )
|
||||
{
|
||||
|
@ -492,23 +497,23 @@ static void CL_DrawCylinder( int modelIndex, float frame, int rendermode, const
|
|||
point[1] = c * freq * delta[2] + source[1];
|
||||
point[2] = source[2] + width;
|
||||
|
||||
TriColor4f( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
re->TexCoord2f( 1.0f, vLast );
|
||||
TriVertex3fv( point );
|
||||
pglColor4f( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
pglTexCoord2f( 1.0f, vLast );
|
||||
pglVertex3fv( point );
|
||||
|
||||
point[0] = s * freq * (delta[2] + width) + source[0];
|
||||
point[1] = c * freq * (delta[2] + width) + source[1];
|
||||
point[2] = source[2] - width;
|
||||
|
||||
TriColor4f( color[0], color[1], color[2], 1.0f );
|
||||
re->TexCoord2f( 0.0f, vLast );
|
||||
TriVertex3fv( point );
|
||||
pglColor4f( color[0], color[1], color[2], 1.0f );
|
||||
pglTexCoord2f( 0.0f, vLast );
|
||||
pglVertex3fv( point );
|
||||
|
||||
vLast += vStep; // Advance texture scroll (v axis only)
|
||||
}
|
||||
|
||||
re->End();
|
||||
re->CullFace( TRI_FRONT );
|
||||
pglEnd();
|
||||
GL_Cull( GL_FRONT );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -526,9 +531,11 @@ void CL_DrawRing( int modelIndex, float frame, int rendermode, const vec3_t sour
|
|||
vec3_t last1, last2, point, screen, screenLast;
|
||||
vec3_t center, xaxis, yaxis, zaxis, tmp, normal;
|
||||
float radius, x, y, scale;
|
||||
HSPRITE m_hSprite = re->GetSpriteTexture( modelIndex, frame );
|
||||
HSPRITE m_hSprite;
|
||||
vec3_t d;
|
||||
|
||||
m_hSprite = R_GetSpriteTexture( CM_ClipHandleToModel( modelIndex ), frame );
|
||||
|
||||
if( !m_hSprite || segments < 2 )
|
||||
return;
|
||||
|
||||
|
@ -575,7 +582,7 @@ void CL_DrawRing( int modelIndex, float frame, int rendermode, const vec3_t sour
|
|||
VectorSubtract( center, last1, screen );
|
||||
|
||||
// Is that box in PVS && frustum?
|
||||
if( !Mod_BoxVisible( screen, tmp, re->GetCurrentVis( )) || re->CullBox( screen, tmp ))
|
||||
if( !Mod_BoxVisible( screen, tmp, Mod_GetCurrentVis( )) || R_CullBox( screen, tmp ))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -589,10 +596,10 @@ void CL_DrawRing( int modelIndex, float frame, int rendermode, const vec3_t sour
|
|||
|
||||
j = segments / 8;
|
||||
|
||||
re->RenderMode( rendermode );
|
||||
re->Bind( m_hSprite, 0 ); // GetSpriteTexture already set frame
|
||||
GL_SetRenderMode( rendermode );
|
||||
GL_Bind( GL_TEXTURE0, m_hSprite );
|
||||
|
||||
re->Begin( TRI_TRIANGLE_STRIP );
|
||||
pglBegin( GL_TRIANGLE_STRIP );
|
||||
|
||||
for( i = 0; i < segments + 1; i++ )
|
||||
{
|
||||
|
@ -631,13 +638,13 @@ void CL_DrawRing( int modelIndex, float frame, int rendermode, const vec3_t sour
|
|||
VectorMA( point, -width, normal, last2 );
|
||||
|
||||
vLast += vStep; // Advance texture scroll (v axis only)
|
||||
TriColor4f( color[0], color[1], color[2], 1.0f );
|
||||
re->TexCoord2f( 1.0f, vLast );
|
||||
TriVertex3fv( last2 );
|
||||
pglColor4f( color[0], color[1], color[2], 1.0f );
|
||||
pglTexCoord2f( 1.0f, vLast );
|
||||
pglVertex3fv( last2 );
|
||||
|
||||
TriColor4f( color[0], color[1], color[2], 1.0f );
|
||||
re->TexCoord2f( 0.0f, vLast );
|
||||
TriVertex3fv( last1 );
|
||||
pglColor4f( color[0], color[1], color[2], 1.0f );
|
||||
pglTexCoord2f( 0.0f, vLast );
|
||||
pglVertex3fv( last1 );
|
||||
}
|
||||
|
||||
VectorCopy( screen, screenLast );
|
||||
|
@ -651,7 +658,7 @@ void CL_DrawRing( int modelIndex, float frame, int rendermode, const vec3_t sour
|
|||
}
|
||||
}
|
||||
|
||||
re->End();
|
||||
pglEnd();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -730,8 +737,10 @@ static void DrawBeamFollow( int modelIndex, particle_t *pHead, int frame, int re
|
|||
float vLast = 0.0;
|
||||
float vStep = 1.0;
|
||||
vec3_t last1, last2, tmp, normal, scaledColor;
|
||||
HSPRITE m_hSprite = re->GetSpriteTexture( modelIndex, frame );
|
||||
HSPRITE m_hSprite;
|
||||
rgb_t nColor;
|
||||
|
||||
m_hSprite = R_GetSpriteTexture( CM_ClipHandleToModel( modelIndex ), frame );
|
||||
|
||||
if( !m_hSprite )
|
||||
return;
|
||||
|
@ -746,7 +755,7 @@ static void DrawBeamFollow( int modelIndex, particle_t *pHead, int frame, int re
|
|||
VectorNormalize( tmp );
|
||||
|
||||
// Build point along noraml line (normal is -y, x)
|
||||
VectorScale( cl.refdef.up, tmp[0], normal ); // Build point along noraml line (normal is -y, x)
|
||||
VectorScale( cl.refdef.up, tmp[0], normal ); // Build point along normal line (normal is -y, x)
|
||||
VectorMA( normal, tmp[1], cl.refdef.right, normal );
|
||||
|
||||
// make a wide line
|
||||
|
@ -761,20 +770,20 @@ static void DrawBeamFollow( int modelIndex, particle_t *pHead, int frame, int re
|
|||
nColor[1] = (byte)bound( 0, (int)(scaledColor[1] * 255.0f), 255 );
|
||||
nColor[2] = (byte)bound( 0, (int)(scaledColor[2] * 255.0f), 255 );
|
||||
|
||||
re->RenderMode( rendermode );
|
||||
re->Bind( m_hSprite, 0 ); // GetSpriteTexture already set frame
|
||||
GL_SetRenderMode( rendermode );
|
||||
GL_Bind( GL_TEXTURE0, m_hSprite );
|
||||
|
||||
re->Begin( TRI_QUADS );
|
||||
pglBegin( GL_QUADS );
|
||||
|
||||
while( pHead )
|
||||
{
|
||||
re->Color4ub( nColor[0], nColor[1], nColor[2], 255 );
|
||||
re->TexCoord2f( 1.0f, 1.0f );
|
||||
TriVertex3fv( last2 );
|
||||
pglColor4ub( nColor[0], nColor[1], nColor[2], 255 );
|
||||
pglTexCoord2f( 1.0f, 1.0f );
|
||||
pglVertex3fv( last2 );
|
||||
|
||||
re->Color4ub( nColor[0], nColor[1], nColor[2], 255 );
|
||||
re->TexCoord2f( 0.0f, 1.0f );
|
||||
TriVertex3fv( last1 );
|
||||
pglColor4ub( nColor[0], nColor[1], nColor[2], 255 );
|
||||
pglTexCoord2f( 0.0f, 1.0f );
|
||||
pglVertex3fv( last1 );
|
||||
|
||||
// Transform point into screen space
|
||||
TriWorldToScreen( pHead->org, screen );
|
||||
|
@ -809,20 +818,20 @@ static void DrawBeamFollow( int modelIndex, particle_t *pHead, int frame, int re
|
|||
fraction = 0.0;
|
||||
}
|
||||
|
||||
re->Color4ub( nColor[0], nColor[1], nColor[2], 255 );
|
||||
re->TexCoord2f( 0.0f, 0.0f );
|
||||
TriVertex3fv( last1 );
|
||||
pglColor4ub( nColor[0], nColor[1], nColor[2], 255 );
|
||||
pglTexCoord2f( 0.0f, 0.0f );
|
||||
pglVertex3fv( last1 );
|
||||
|
||||
re->Color4ub( nColor[0], nColor[1], nColor[2], 255 );
|
||||
re->TexCoord2f( 1.0f, 0.0f );
|
||||
TriVertex3fv( last2 );
|
||||
pglColor4ub( nColor[0], nColor[1], nColor[2], 255 );
|
||||
pglTexCoord2f( 1.0f, 0.0f );
|
||||
pglVertex3fv( last2 );
|
||||
|
||||
VectorCopy( screen, screenLast );
|
||||
|
||||
pHead = pHead->next;
|
||||
}
|
||||
|
||||
re->End();
|
||||
pglEnd();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1103,9 +1112,9 @@ qboolean CL_CullBeam( const vec3_t start, const vec3_t end, qboolean pvsOnly )
|
|||
}
|
||||
|
||||
// check bbox
|
||||
if( Mod_BoxVisible( mins, maxs, re->GetCurrentVis( )))
|
||||
if( Mod_BoxVisible( mins, maxs, Mod_GetCurrentVis( )))
|
||||
{
|
||||
if( pvsOnly || !re->CullBox( mins, maxs ))
|
||||
if( pvsOnly || !R_CullBox( mins, maxs ))
|
||||
{
|
||||
// beam is visible
|
||||
return false;
|
|
@ -0,0 +1,22 @@
|
|||
//=======================================================================
|
||||
// Copyright XashXT Group 2010 ©
|
||||
// gl_decals.c - decal paste and rendering
|
||||
//=======================================================================
|
||||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "gl_local.h"
|
||||
|
||||
qboolean R_DecalShoot( int texture, int ent, int model, vec3_t pos, vec3_t saxis, int flags, rgba_t color )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int R_CreateDecalList( decallist_t *pList, qboolean changelevel )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void R_DecalRemoveAll( int texture )
|
||||
{
|
||||
}
|
|
@ -7,6 +7,48 @@
|
|||
#include "client.h"
|
||||
#include "gl_local.h"
|
||||
|
||||
/*
|
||||
=============
|
||||
R_GetImageParms
|
||||
=============
|
||||
*/
|
||||
void R_GetTextureParms( int *w, int *h, int texnum )
|
||||
{
|
||||
gltexture_t *glt;
|
||||
|
||||
glt = R_GetTexture( texnum );
|
||||
if( w ) *w = glt->srcWidth;
|
||||
if( h ) *h = glt->srcHeight;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
R_GetSpriteParms
|
||||
|
||||
same as GetImageParms but used
|
||||
for sprite models
|
||||
=============
|
||||
*/
|
||||
void R_GetSpriteParms( int *frameWidth, int *frameHeight, int *numFrames, int currentFrame, const model_t *pSprite )
|
||||
{
|
||||
mspriteframe_t *pFrame;
|
||||
|
||||
if( !pSprite || pSprite->type != mod_sprite ) return; // bad model ?
|
||||
pFrame = R_GetSpriteFrame( pSprite, currentFrame, 0.0f );
|
||||
|
||||
if( frameWidth ) *frameWidth = pFrame->width;
|
||||
if( frameHeight ) *frameHeight = pFrame->height;
|
||||
if( numFrames ) *numFrames = pSprite->numframes;
|
||||
}
|
||||
|
||||
int R_GetSpriteTexture( const model_t *m_pSpriteModel, int frame )
|
||||
{
|
||||
if( !m_pSpriteModel || m_pSpriteModel->type != mod_sprite || !m_pSpriteModel->cache.data )
|
||||
return 0;
|
||||
|
||||
return R_GetSpriteFrame( m_pSpriteModel, frame, 0.0f )->gl_texturenum;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_DrawSetColor
|
||||
|
@ -134,7 +176,7 @@ void R_Set2DMode( qboolean enable )
|
|||
pglLoadIdentity();
|
||||
|
||||
GL_Cull( 0 );
|
||||
// GL_SetState( GLSTATE_NO_DEPTH_TEST );
|
||||
GL_SetState( GLSTATE_NO_DEPTH_TEST );
|
||||
|
||||
pglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
|
||||
|
|
|
@ -422,7 +422,6 @@ static GLenum GL_TextureFormat( gltexture_t *tex, int samples )
|
|||
{
|
||||
format = GL_DEPTH_COMPONENT;
|
||||
tex->flags &= ~TF_INTENSITY;
|
||||
tex->flags &= ~TF_ALPHA;
|
||||
}
|
||||
else if( compress )
|
||||
{
|
||||
|
@ -436,10 +435,7 @@ static GLenum GL_TextureFormat( gltexture_t *tex, int samples )
|
|||
|
||||
if( tex->flags & TF_INTENSITY )
|
||||
format = GL_COMPRESSED_INTENSITY_ARB;
|
||||
if( tex->flags & TF_ALPHA )
|
||||
format = GL_COMPRESSED_ALPHA_ARB;
|
||||
tex->flags &= ~TF_INTENSITY;
|
||||
tex->flags &= ~TF_ALPHA;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -470,10 +466,7 @@ static GLenum GL_TextureFormat( gltexture_t *tex, int samples )
|
|||
|
||||
if( tex->flags & TF_INTENSITY )
|
||||
format = GL_INTENSITY8;
|
||||
if( tex->flags & TF_ALPHA )
|
||||
format = GL_ALPHA8;
|
||||
tex->flags &= ~TF_INTENSITY;
|
||||
tex->flags &= ~TF_ALPHA;
|
||||
}
|
||||
return format;
|
||||
}
|
||||
|
@ -665,6 +658,36 @@ void GL_GenerateMipmaps( byte *buffer, rgbdata_t *pic, gltexture_t *tex, GLenum
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
GL_MakeLuminance
|
||||
|
||||
Converts the given image to luminance
|
||||
=================
|
||||
*/
|
||||
void GL_MakeLuminance( rgbdata_t *in )
|
||||
{
|
||||
byte luminance;
|
||||
float r, g, b;
|
||||
int x, y;
|
||||
|
||||
for( y = 0; y < in->height; y++ )
|
||||
{
|
||||
for( x = 0; x < in->width; x++ )
|
||||
{
|
||||
r = r_luminanceTable[in->buffer[4*(y*in->width+x)+0]][0];
|
||||
g = r_luminanceTable[in->buffer[4*(y*in->width+x)+1]][1];
|
||||
b = r_luminanceTable[in->buffer[4*(y*in->width+x)+2]][2];
|
||||
|
||||
luminance = (byte)(r + g + b);
|
||||
|
||||
in->buffer[4*(y*in->width+x)+0] = luminance;
|
||||
in->buffer[4*(y*in->width+x)+1] = luminance;
|
||||
in->buffer[4*(y*in->width+x)+2] = luminance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
GL_UploadTexture
|
||||
|
@ -678,8 +701,7 @@ static void GL_UploadTexture( rgbdata_t *pic, gltexture_t *tex, qboolean subImag
|
|||
const byte *bufend;
|
||||
GLenum outFormat, inFormat, glTarget;
|
||||
uint i, s, numSides, offset = 0;
|
||||
int img_flags = IMAGE_FORCE_RGBA;
|
||||
int texsize = 0, samples;
|
||||
int texsize = 0, img_flags = 0, samples;
|
||||
|
||||
ASSERT( pic != NULL && tex != NULL );
|
||||
|
||||
|
@ -706,9 +728,20 @@ static void GL_UploadTexture( rgbdata_t *pic, gltexture_t *tex, qboolean subImag
|
|||
tex->flags &= ~TF_MAKELUMA;
|
||||
}
|
||||
|
||||
// we need to expand image into RGBA buffer
|
||||
if( pic->type == PF_INDEXED_24 || pic->type == PF_INDEXED_32 )
|
||||
img_flags |= IMAGE_FORCE_RGBA;
|
||||
|
||||
// processing image before uploading (force to rgba, make luma etc)
|
||||
Image_Process( &pic, 0, 0, img_flags );
|
||||
|
||||
if( tex->flags & TF_LUMINANCE )
|
||||
{
|
||||
GL_MakeLuminance( pic );
|
||||
tex->flags &= ~TF_LUMINANCE;
|
||||
pic->flags &= ~IMAGE_HAS_COLOR;
|
||||
}
|
||||
|
||||
samples = GL_CalcTextureSamples( pic->flags );
|
||||
|
||||
// determine format
|
||||
|
@ -866,6 +899,19 @@ int GL_LoadTextureInternal( const char *name, rgbdata_t *pic, texFlags_t flags,
|
|||
MsgDev( D_ERROR, "GL_LoadTexture: too long name %s\n", name, sizeof( r_textures->name ));
|
||||
return 0;
|
||||
}
|
||||
|
||||
// see if already loaded
|
||||
hash = Com_HashKey( name, TEXTURES_HASH_SIZE );
|
||||
|
||||
for( tex = r_texturesHashTable[hash]; tex != NULL; tex = tex->nextHash )
|
||||
{
|
||||
if( tex->flags & TF_CUBEMAP )
|
||||
continue;
|
||||
|
||||
if( !com.stricmp( tex->name, name ))
|
||||
return tex->texnum;
|
||||
}
|
||||
|
||||
if( !pic ) return 0; // couldn't loading image
|
||||
|
||||
// find a free texture slot
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "gl_export.h"
|
||||
#include "com_model.h"
|
||||
#include "cl_entity.h"
|
||||
#include "ref_params.h"
|
||||
|
||||
extern byte *r_temppool;
|
||||
|
||||
|
@ -32,24 +33,46 @@ typedef enum
|
|||
TEX_CUBEMAP // cubemap textures
|
||||
} texType_t;
|
||||
|
||||
typedef enum
|
||||
enum
|
||||
{
|
||||
TF_STATIC = BIT(0), // don't free until Shader_FreeUnused()
|
||||
TF_NOPICMIP = BIT(1), // ignore r_picmip resample rules
|
||||
TF_UNCOMPRESSED = BIT(2), // don't compress texture in video memory
|
||||
TF_CUBEMAP = BIT(3), // it's cubemap texture
|
||||
TF_DEPTHMAP = BIT(4), // custom texture filter used
|
||||
TF_INTENSITY = BIT(5),
|
||||
TF_ALPHA = BIT(6),
|
||||
TF_SKYSIDE = BIT(7),
|
||||
TF_CLAMP = BIT(8),
|
||||
TF_NOMIPMAP = BIT(9),
|
||||
TF_NEAREST = BIT(10), // disable texfilter
|
||||
TF_LIGHTMAP = BIT(11), // no resample etc
|
||||
TF_HAS_LUMA = BIT(12), // sets by GL_UploadTexture
|
||||
TF_MAKELUMA = BIT(13), // create luma from quake texture
|
||||
TF_NORMALMAP = BIT(14), // is a normalmap
|
||||
} texFlags_t;
|
||||
GLSTATE_NONE = 0,
|
||||
GLSTATE_SRCBLEND_ZERO = 1,
|
||||
GLSTATE_SRCBLEND_ONE = 2,
|
||||
GLSTATE_SRCBLEND_DST_COLOR = 1|2,
|
||||
GLSTATE_SRCBLEND_ONE_MINUS_DST_COLOR = 4,
|
||||
GLSTATE_SRCBLEND_SRC_ALPHA = 1|4,
|
||||
GLSTATE_SRCBLEND_ONE_MINUS_SRC_ALPHA = 2|4,
|
||||
GLSTATE_SRCBLEND_DST_ALPHA = 1|2|4,
|
||||
GLSTATE_SRCBLEND_ONE_MINUS_DST_ALPHA = 8,
|
||||
GLSTATE_DSTBLEND_ZERO = 16,
|
||||
GLSTATE_DSTBLEND_ONE = 32,
|
||||
GLSTATE_DSTBLEND_SRC_COLOR = 16|32,
|
||||
GLSTATE_DSTBLEND_ONE_MINUS_SRC_COLOR = 64,
|
||||
GLSTATE_DSTBLEND_SRC_ALPHA = 16|64,
|
||||
GLSTATE_DSTBLEND_ONE_MINUS_SRC_ALPHA = 32|64,
|
||||
GLSTATE_DSTBLEND_DST_ALPHA = 16|32|64,
|
||||
GLSTATE_DSTBLEND_ONE_MINUS_DST_ALPHA = 128,
|
||||
GLSTATE_BLEND_MTEX = 0x100,
|
||||
GLSTATE_AFUNC_GT0 = 0x200,
|
||||
GLSTATE_AFUNC_LT128 = 0x400,
|
||||
GLSTATE_AFUNC_GE128 = 0x800,
|
||||
GLSTATE_DEPTHWRITE = 0x1000,
|
||||
GLSTATE_DEPTHFUNC_EQ = 0x2000,
|
||||
GLSTATE_OFFSET_FILL = 0x4000,
|
||||
GLSTATE_NO_DEPTH_TEST = 0x8000,
|
||||
GLSTATE_MARK_END = 0x10000 // SHADERPASS_MARK_BEGIN
|
||||
};
|
||||
|
||||
#define GLSTATE_MASK ( GLSTATE_MARK_END-1 )
|
||||
|
||||
// #define SHADERPASS_SRCBLEND_MASK (((GLSTATE_SRCBLEND_DST_ALPHA)<<1)-GLSTATE_SRCBLEND_ZERO)
|
||||
#define GLSTATE_SRCBLEND_MASK 0xF
|
||||
|
||||
// #define SHADERPASS_DSTBLEND_MASK (((GLSTATE_DSTBLEND_DST_ALPHA)<<1)-GLSTATE_DSTBLEND_ZERO)
|
||||
#define GLSTATE_DSTBLEND_MASK 0xF0
|
||||
|
||||
#define GLSTATE_BLENDFUNC ( GLSTATE_SRCBLEND_MASK|GLSTATE_DSTBLEND_MASK )
|
||||
#define GLSTATE_ALPHAFUNC ( GLSTATE_AFUNC_GT0|GLSTATE_AFUNC_LT128|GLSTATE_AFUNC_GE128 )
|
||||
|
||||
typedef struct gltexture_s
|
||||
{
|
||||
|
@ -77,6 +100,8 @@ typedef struct
|
|||
qboolean drawWorld; // ignore world for drawing PlayerModel
|
||||
qboolean thirdPerson; // thirdperson camera is enabled
|
||||
|
||||
ref_params_t refdef; // actual refdef
|
||||
|
||||
cl_entity_t *currententity;
|
||||
model_t *currentmodel;
|
||||
} ref_instance_t;
|
||||
|
@ -105,7 +130,9 @@ void GL_BuildPolygonFromSurface( msurface_t *fa );
|
|||
void GL_Bind( GLenum tmu, GLenum texnum );
|
||||
void GL_TexGen( GLenum coord, GLenum mode );
|
||||
void GL_SelectTexture( GLenum texture );
|
||||
void GL_SetRenderMode( int mode );
|
||||
void GL_FrontFace( GLenum front );
|
||||
void GL_SetState( int state );
|
||||
void GL_TexEnv( GLenum mode );
|
||||
void GL_Cull( GLenum cull );
|
||||
|
||||
|
@ -124,6 +151,7 @@ int GL_LoadTextureInternal( const char *name, rgbdata_t *pic, texFlags_t flags,
|
|||
byte *GL_ResampleTexture( const byte *source, int inWidth, int inHeight, int outWidth, int outHeight, qboolean isNormalMap );
|
||||
void GL_FreeTexture( GLenum texnum );
|
||||
void GL_FreeImage( const char *name );
|
||||
void R_TextureList_f( void );
|
||||
void R_InitImages( void );
|
||||
void R_ShutdownImages( void );
|
||||
|
||||
|
@ -133,6 +161,12 @@ void R_ShutdownImages( void );
|
|||
void R_ClearScene( void );
|
||||
void R_DrawCubemapView( const vec3_t origin, const vec3_t angles, int size );
|
||||
|
||||
//
|
||||
// gl_sprite.c
|
||||
//
|
||||
void Mod_LoadSpriteModel( model_t *mod, const void *buffer );
|
||||
mspriteframe_t *R_GetSpriteFrame( const model_t *pModel, int frame, float yaw );
|
||||
|
||||
//
|
||||
// gl_vidnt.c
|
||||
//
|
||||
|
@ -303,6 +337,7 @@ extern convar_t *gl_clear;
|
|||
|
||||
extern convar_t *r_width;
|
||||
extern convar_t *r_height;
|
||||
extern convar_t *r_speeds;
|
||||
|
||||
extern convar_t *vid_displayfrequency;
|
||||
extern convar_t *vid_fullscreen;
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
//=======================================================================
|
||||
// Copyright XashXT Group 2010 ©
|
||||
// gl_rlight.c - dynamic and static lights
|
||||
//=======================================================================
|
||||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "gl_local.h"
|
||||
|
||||
void R_LightForPoint( const vec3_t point, vec3_t ambientLight )
|
||||
{
|
||||
}
|
||||
|
||||
qboolean R_AddDLight( vec3_t pos, color24 color, float radius, int flags )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
qboolean R_SetLightStyle( int stylenum, vec3_t color )
|
||||
{
|
||||
return false;
|
||||
}
|
|
@ -7,9 +7,38 @@
|
|||
#include "client.h"
|
||||
#include "gl_local.h"
|
||||
|
||||
char r_speeds_msg[MAX_SYSPATH];
|
||||
ref_params_t r_lastRefdef;
|
||||
ref_instance_t RI;
|
||||
|
||||
/*
|
||||
===============
|
||||
R_SpeedsMessage
|
||||
===============
|
||||
*/
|
||||
qboolean R_SpeedsMessage( char *out, size_t size )
|
||||
{
|
||||
if( r_speeds->integer <= 0 ) return false;
|
||||
if( !out || !size ) return false;
|
||||
|
||||
com.strncpy( out, r_speeds_msg, size );
|
||||
return true;
|
||||
}
|
||||
|
||||
qboolean R_CullBox( const vec3_t mins, const vec3_t maxs )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
qboolean R_WorldToScreen( const vec3_t point, vec3_t screen )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void R_ScreenToWorld( const vec3_t screen, vec3_t point )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_ClearScene
|
||||
|
@ -19,6 +48,16 @@ void R_ClearScene( void )
|
|||
{
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_AddEntity
|
||||
===============
|
||||
*/
|
||||
qboolean R_AddEntity( struct cl_entity_s *pRefEntity, int entityType, int customTexture )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_BeginFrame
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "gl_local.h"
|
||||
#include "r_efx.h"
|
||||
#include "event_flags.h"
|
||||
#include "entity_types.h"
|
||||
|
@ -406,24 +407,24 @@ void CL_UpdateParticle( particle_t *p, float ft )
|
|||
p->color = bound( 0, p->color, 255 );
|
||||
VectorSet( color, clgame.palette[p->color][0], clgame.palette[p->color][1], clgame.palette[p->color][2] );
|
||||
|
||||
re->RenderMode( kRenderTransTexture );
|
||||
re->Color4ub( color[0], color[1], color[2], alpha );
|
||||
GL_SetRenderMode( kRenderTransTexture );
|
||||
pglColor4ub( color[0], color[1], color[2], alpha );
|
||||
|
||||
re->Bind( cls.particleShader, 0 );
|
||||
GL_Bind( GL_TEXTURE0, cls.particleImage );
|
||||
|
||||
// add the 4 corner vertices.
|
||||
re->Begin( TRI_QUADS );
|
||||
pglBegin( GL_QUADS );
|
||||
|
||||
re->TexCoord2f( 0.0f, 1.0f );
|
||||
re->Vertex3f( p->org[0] - right[0] + up[0], p->org[1] - right[1] + up[1], p->org[2] - right[2] + up[2] );
|
||||
re->TexCoord2f( 0.0f, 0.0f );
|
||||
re->Vertex3f( p->org[0] + right[0] + up[0], p->org[1] + right[1] + up[1], p->org[2] + right[2] + up[2] );
|
||||
re->TexCoord2f( 1.0f, 0.0f );
|
||||
re->Vertex3f( p->org[0] + right[0] - up[0], p->org[1] + right[1] - up[1], p->org[2] + right[2] - up[2] );
|
||||
re->TexCoord2f( 1.0f, 1.0f );
|
||||
re->Vertex3f( p->org[0] - right[0] - up[0], p->org[1] - right[1] - up[1], p->org[2] - right[2] - up[2] );
|
||||
pglTexCoord2f( 0.0f, 1.0f );
|
||||
pglVertex3f( p->org[0] - right[0] + up[0], p->org[1] - right[1] + up[1], p->org[2] - right[2] + up[2] );
|
||||
pglTexCoord2f( 0.0f, 0.0f );
|
||||
pglVertex3f( p->org[0] + right[0] + up[0], p->org[1] + right[1] + up[1], p->org[2] + right[2] + up[2] );
|
||||
pglTexCoord2f( 1.0f, 0.0f );
|
||||
pglVertex3f( p->org[0] + right[0] - up[0], p->org[1] + right[1] - up[1], p->org[2] + right[2] - up[2] );
|
||||
pglTexCoord2f( 1.0f, 1.0f );
|
||||
pglVertex3f( p->org[0] - right[0] - up[0], p->org[1] - right[1] - up[1], p->org[2] - right[2] - up[2] );
|
||||
|
||||
re->End();
|
||||
pglEnd();
|
||||
|
||||
if( p->type != pt_clientcustom )
|
||||
{
|
||||
|
@ -1159,8 +1160,6 @@ static qboolean CL_CullTracer( const vec3_t start, const vec3_t end )
|
|||
vec3_t mins, maxs;
|
||||
int i;
|
||||
|
||||
if( !re ) return true; // culled
|
||||
|
||||
// compute the bounding box
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
|
@ -1183,7 +1182,7 @@ static qboolean CL_CullTracer( const vec3_t start, const vec3_t end )
|
|||
}
|
||||
|
||||
// check bbox
|
||||
return re->CullBox( mins, maxs );
|
||||
return R_CullBox( mins, maxs );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1247,26 +1246,26 @@ void CL_DrawTracer( vec3_t start, vec3_t delta, float width, rgb_t color, int al
|
|||
// NOTE: Gotta get the winding right so it's not backface culled
|
||||
// (we need to turn of backface culling for these bad boys)
|
||||
|
||||
re->RenderMode( kRenderTransTexture );
|
||||
GL_SetRenderMode( kRenderTransTexture );
|
||||
|
||||
re->Color4ub( color[0], color[1], color[2], alpha );
|
||||
pglColor4ub( color[0], color[1], color[2], alpha );
|
||||
|
||||
re->Bind( cls.particleShader, 0 );
|
||||
re->Begin( TRI_QUADS );
|
||||
GL_Bind( GL_TEXTURE0, cls.particleImage );
|
||||
pglBegin( GL_QUADS );
|
||||
|
||||
re->TexCoord2f( 0.0f, endV );
|
||||
TriVertex3fv( verts[2] );
|
||||
pglTexCoord2f( 0.0f, endV );
|
||||
pglVertex3fv( verts[2] );
|
||||
|
||||
re->TexCoord2f( 1.0f, endV );
|
||||
TriVertex3fv( verts[3] );
|
||||
pglTexCoord2f( 1.0f, endV );
|
||||
pglVertex3fv( verts[3] );
|
||||
|
||||
re->TexCoord2f( 1.0f, startV );
|
||||
TriVertex3fv( verts[1] );
|
||||
pglTexCoord2f( 1.0f, startV );
|
||||
pglVertex3fv( verts[1] );
|
||||
|
||||
re->TexCoord2f( 0.0f, startV );
|
||||
TriVertex3fv( verts[0] );
|
||||
pglTexCoord2f( 0.0f, startV );
|
||||
pglVertex3fv( verts[0] );
|
||||
|
||||
re->End();
|
||||
pglEnd();
|
||||
}
|
||||
|
||||
/*
|
|
@ -16,6 +16,12 @@
|
|||
#define SUBDIVIDE_SIZE 64
|
||||
//#define SUBDIVIDE_SIZE 1024
|
||||
|
||||
byte *Mod_GetCurrentVis( void )
|
||||
{
|
||||
// return Mod_LeafPVS( r_viewleaf, r_worldmodel );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void BoundPoly( int numverts, float *verts, vec3_t mins, vec3_t maxs )
|
||||
{
|
||||
int i, j;
|
||||
|
|
|
@ -0,0 +1,424 @@
|
|||
//=======================================================================
|
||||
// Copyright XashXT Group 2010 ©
|
||||
// gl_sprite.c - sprite rendering
|
||||
//=======================================================================
|
||||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "gl_local.h"
|
||||
#include "sprite.h"
|
||||
|
||||
#define MAPSPRITE_SIZE 128 // it's a Valve default value for LoadMapSprite (probably must be power of two)
|
||||
|
||||
char sprite_name[64];
|
||||
char group_suffix[8];
|
||||
|
||||
/*
|
||||
====================
|
||||
R_SpriteLoadFrame
|
||||
|
||||
upload a single frame
|
||||
====================
|
||||
*/
|
||||
static dframetype_t *R_SpriteLoadFrame( model_t *mod, void *pin, mspriteframe_t **ppframe, int num )
|
||||
{
|
||||
dspriteframe_t *pinframe;
|
||||
mspriteframe_t *pspriteframe;
|
||||
char texname[64];
|
||||
|
||||
// build uinque frame name
|
||||
if( !sprite_name[0] ) FS_FileBase( mod->name, sprite_name );
|
||||
com.snprintf( texname, sizeof( texname ), "#%s_%s_%i%i.spr", sprite_name, group_suffix, num / 10, num % 10 );
|
||||
|
||||
pinframe = (dspriteframe_t *)pin;
|
||||
|
||||
Msg( "Load: %s\n", texname );
|
||||
|
||||
// setup frame description
|
||||
pspriteframe = Mem_Alloc( mod->mempool, sizeof( mspriteframe_t ));
|
||||
pspriteframe->width = pinframe->width;
|
||||
pspriteframe->height = pinframe->height;
|
||||
pspriteframe->up = pinframe->origin[1];
|
||||
pspriteframe->left = pinframe->origin[0];
|
||||
pspriteframe->down = pinframe->origin[1] - pinframe->height;
|
||||
pspriteframe->right = pinframe->width + pinframe->origin[0];
|
||||
pspriteframe->gl_texturenum = GL_LoadTexture( texname, pin, pinframe->width * pinframe->height, 0 );
|
||||
*ppframe = pspriteframe;
|
||||
|
||||
return (dframetype_t *)((byte *)(pinframe + 1) + pinframe->width * pinframe->height );
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
R_SpriteLoadGroup
|
||||
|
||||
upload a group frames
|
||||
====================
|
||||
*/
|
||||
static dframetype_t *R_SpriteLoadGroup( model_t *mod, void *pin, mspriteframe_t **ppframe, int framenum )
|
||||
{
|
||||
dspritegroup_t *pingroup;
|
||||
mspritegroup_t *pspritegroup;
|
||||
dspriteinterval_t *pin_intervals;
|
||||
float *poutintervals;
|
||||
int i, groupsize, numframes;
|
||||
void *ptemp;
|
||||
|
||||
pingroup = (dspritegroup_t *)pin;
|
||||
numframes = pingroup->numframes;
|
||||
|
||||
groupsize = sizeof( mspritegroup_t ) + (numframes - 1) * sizeof( pspritegroup->frames[0] );
|
||||
pspritegroup = Mem_Alloc( mod->mempool, groupsize );
|
||||
pspritegroup->numframes = numframes;
|
||||
|
||||
*ppframe = (mspriteframe_t *)pspritegroup;
|
||||
pin_intervals = (dspriteinterval_t *)(pingroup + 1);
|
||||
poutintervals = Mem_Alloc( mod->mempool, numframes * sizeof( float ));
|
||||
pspritegroup->intervals = poutintervals;
|
||||
|
||||
for( i = 0; i < numframes; i++ )
|
||||
{
|
||||
*poutintervals = pin_intervals->interval;
|
||||
if( *poutintervals <= 0.0f )
|
||||
*poutintervals = 1.0f; // set error value
|
||||
poutintervals++;
|
||||
pin_intervals++;
|
||||
}
|
||||
|
||||
ptemp = (void *)pin_intervals;
|
||||
for( i = 0; i < numframes; i++ )
|
||||
{
|
||||
ptemp = R_SpriteLoadFrame( mod, ptemp, &pspritegroup->frames[i], framenum * 10 + i );
|
||||
}
|
||||
|
||||
return (dframetype_t *)ptemp;
|
||||
}
|
||||
|
||||
void Mod_LoadSpriteModel( model_t *mod, const void *buffer )
|
||||
{
|
||||
dsprite_t *pin;
|
||||
short *numi;
|
||||
msprite_t *psprite;
|
||||
dframetype_t *pframetype;
|
||||
int i, size;
|
||||
|
||||
pin = (dsprite_t *)buffer;
|
||||
i = pin->version;
|
||||
|
||||
if( pin->ident != IDSPRITEHEADER )
|
||||
{
|
||||
MsgDev( D_ERROR, "%s has wrong id (%x should be %x)\n", mod->name, pin->ident, IDSPRITEHEADER );
|
||||
return;
|
||||
}
|
||||
|
||||
if( i != SPRITE_VERSION )
|
||||
{
|
||||
MsgDev( D_ERROR, "%s has wrong version number (%i should be %i)\n", mod->name, i, SPRITE_VERSION );
|
||||
return;
|
||||
}
|
||||
|
||||
mod->mempool = Mem_AllocPool( va( "^2%s^7", mod->name ));
|
||||
size = sizeof( msprite_t ) + ( pin->numframes - 1 ) * sizeof( psprite->frames );
|
||||
psprite = Mem_Alloc( mod->mempool, size );
|
||||
mod->cache.data = psprite; // make link to extradata
|
||||
|
||||
psprite->type = pin->type;
|
||||
psprite->texFormat = pin->texFormat;
|
||||
psprite->numframes = mod->numframes = pin->numframes;
|
||||
psprite->facecull = pin->facetype;
|
||||
psprite->radius = pin->boundingradius;
|
||||
psprite->synctype = pin->synctype;
|
||||
|
||||
mod->mins[0] = mod->mins[1] = -pin->bounds[0] / 2;
|
||||
mod->maxs[0] = mod->maxs[1] = pin->bounds[0] / 2;
|
||||
mod->mins[2] = -pin->bounds[1] / 2;
|
||||
mod->maxs[2] = pin->bounds[1] / 2;
|
||||
numi = (short *)(pin + 1);
|
||||
|
||||
if( *numi == 256 )
|
||||
{
|
||||
byte *src = (byte *)(numi+1);
|
||||
rgbdata_t *pal;
|
||||
|
||||
// install palette
|
||||
switch( psprite->texFormat )
|
||||
{
|
||||
case SPR_ADDGLOW:
|
||||
pal = FS_LoadImage( "#normal.pal", src, 768 );
|
||||
break;
|
||||
case SPR_ADDITIVE:
|
||||
pal = FS_LoadImage( "#normal.pal", src, 768 );
|
||||
break;
|
||||
case SPR_INDEXALPHA:
|
||||
pal = FS_LoadImage( "#decal.pal", src, 768 );
|
||||
break;
|
||||
case SPR_ALPHTEST:
|
||||
pal = FS_LoadImage( "#transparent.pal", src, 768 );
|
||||
break;
|
||||
case SPR_NORMAL:
|
||||
default:
|
||||
pal = FS_LoadImage( "#normal.pal", src, 768 );
|
||||
break;
|
||||
}
|
||||
|
||||
pframetype = (dframetype_t *)(src + 768);
|
||||
FS_FreeImage( pal ); // palette installed, no reason to keep this data
|
||||
}
|
||||
else
|
||||
{
|
||||
MsgDev( D_ERROR, "%s has wrong number of palette colors %i (should be 256)\n", mod->name, numi );
|
||||
Mem_FreePool( &mod->mempool );
|
||||
return;
|
||||
}
|
||||
|
||||
if( pin->numframes < 1 )
|
||||
{
|
||||
MsgDev( D_ERROR, "%s has invalid # of frames: %d\n", mod->name, pin->numframes );
|
||||
Mem_FreePool( &mod->mempool );
|
||||
return;
|
||||
}
|
||||
|
||||
// reset the sprite name
|
||||
sprite_name[0] = '\0';
|
||||
|
||||
for( i = 0; i < pin->numframes; i++ )
|
||||
{
|
||||
frametype_t frametype = pframetype->type;
|
||||
psprite->frames[i].type = frametype;
|
||||
|
||||
switch( frametype )
|
||||
{
|
||||
case FRAME_SINGLE:
|
||||
com.strncpy( group_suffix, "one", sizeof( group_suffix ));
|
||||
pframetype = R_SpriteLoadFrame( mod, pframetype + 1, &psprite->frames[i].frameptr, i );
|
||||
break;
|
||||
case FRAME_GROUP:
|
||||
com.strncpy( group_suffix, "grp", sizeof( group_suffix ));
|
||||
pframetype = R_SpriteLoadGroup( mod, pframetype + 1, &psprite->frames[i].frameptr, i );
|
||||
break;
|
||||
case FRAME_ANGLED:
|
||||
com.strncpy( group_suffix, "ang", sizeof( group_suffix ));
|
||||
pframetype = R_SpriteLoadGroup( mod, pframetype + 1, &psprite->frames[i].frameptr, i );
|
||||
break;
|
||||
}
|
||||
if( pframetype == NULL ) break; // technically an error
|
||||
}
|
||||
|
||||
mod->type = mod_sprite; // done
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
Mod_LoadMapSprite
|
||||
|
||||
Loading a bitmap image as sprite with multiple frames
|
||||
as pieces of input image
|
||||
====================
|
||||
*/
|
||||
void Mod_LoadMapSprite( model_t *mod, const void *buffer, size_t size )
|
||||
{
|
||||
byte *src, *dst;
|
||||
rgbdata_t *pix, temp;
|
||||
char texname[64];
|
||||
int i, j, x, y, w, h;
|
||||
int xl, yl, xh, yh;
|
||||
int linedelta, numframes;
|
||||
mspriteframe_t *pspriteframe;
|
||||
msprite_t *psprite;
|
||||
|
||||
com.snprintf( texname, sizeof( texname ), "#%s", mod->name );
|
||||
pix = FS_LoadImage( texname, buffer, size );
|
||||
if( !pix ) return; // bad image or something else
|
||||
|
||||
if( pix->width % MAPSPRITE_SIZE )
|
||||
w = pix->width - ( pix->width % MAPSPRITE_SIZE );
|
||||
else w = pix->width;
|
||||
|
||||
if( pix->height % MAPSPRITE_SIZE )
|
||||
h = pix->height - ( pix->height % MAPSPRITE_SIZE );
|
||||
else h = pix->height;
|
||||
|
||||
if( w < MAPSPRITE_SIZE ) w = MAPSPRITE_SIZE;
|
||||
if( h < MAPSPRITE_SIZE ) h = MAPSPRITE_SIZE;
|
||||
|
||||
// resample image if needed
|
||||
Image_Process( &pix, w, h, IMAGE_FORCE_RGBA|IMAGE_RESAMPLE );
|
||||
|
||||
w = h = MAPSPRITE_SIZE;
|
||||
|
||||
// check range
|
||||
if( w > pix->width ) w = pix->width;
|
||||
if( h > pix->height ) h = pix->height;
|
||||
|
||||
// determine how many frames we needs
|
||||
numframes = (pix->width * pix->height) / (w * h);
|
||||
mod->mempool = Mem_AllocPool( va( "^2%s^7", mod->name ));
|
||||
psprite = Mem_Alloc( mod->mempool, sizeof( msprite_t ) + ( numframes - 1 ) * sizeof( psprite->frames ));
|
||||
mod->cache.data = psprite; // make link to extradata
|
||||
|
||||
psprite->type = SPR_FWD_PARALLEL_ORIENTED;
|
||||
psprite->texFormat = SPR_ALPHTEST;
|
||||
psprite->numframes = mod->numframes = numframes;
|
||||
psprite->radius = com.sqrt((( w >> 1) * (w >> 1)) + ((h >> 1) * (h >> 1)));
|
||||
|
||||
mod->mins[0] = mod->mins[1] = -w / 2;
|
||||
mod->maxs[0] = mod->maxs[1] = w / 2;
|
||||
mod->mins[2] = -h / 2;
|
||||
mod->maxs[2] = h / 2;
|
||||
|
||||
// create a temporary pic
|
||||
temp.width = w;
|
||||
temp.height = h;
|
||||
temp.type = pix->type;
|
||||
temp.flags = pix->flags;
|
||||
temp.size = w * h * PFDesc( temp.type )->bpp;
|
||||
temp.buffer = Mem_Alloc( r_temppool, temp.size );
|
||||
temp.palette = NULL;
|
||||
|
||||
// reset the sprite name
|
||||
sprite_name[0] = '\0';
|
||||
|
||||
Msg( "%s %i frames\n", mod->name, numframes );
|
||||
|
||||
// chop the image and upload into video memory
|
||||
for( i = xl = yl = 0; i < numframes; i++ )
|
||||
{
|
||||
xh = xl + w;
|
||||
yh = yl + h;
|
||||
|
||||
src = pix->buffer + ( yl * pix->width + xl ) * 4;
|
||||
linedelta = ( pix->width - w ) * 4;
|
||||
dst = temp.buffer;
|
||||
|
||||
// cut block from source
|
||||
for( y = yl; y < yh; y++ )
|
||||
{
|
||||
for( x = xl; x < xh; x++ )
|
||||
for( j = 0; j < 4; j++ )
|
||||
*dst++ = *src++;
|
||||
src += linedelta;
|
||||
}
|
||||
|
||||
// build uinque frame name
|
||||
if( !sprite_name[0] ) FS_FileBase( mod->name, sprite_name );
|
||||
com.snprintf( texname, sizeof( texname ), "#%s_%i%i.spr", sprite_name, i / 10, i % 10 );
|
||||
|
||||
psprite->frames[i].frameptr = Mem_Alloc( mod->mempool, sizeof( mspriteframe_t ));
|
||||
pspriteframe = psprite->frames[i].frameptr;
|
||||
pspriteframe->width = w;
|
||||
pspriteframe->height = h;
|
||||
pspriteframe->up = ( h >> 1 );
|
||||
pspriteframe->left = -( w >> 1 );
|
||||
pspriteframe->down = ( h >> 1 ) - h;
|
||||
pspriteframe->right = w + -( w >> 1 );
|
||||
pspriteframe->gl_texturenum = GL_LoadTextureInternal( texname, &temp, TF_IMAGE, false );
|
||||
|
||||
xl += w;
|
||||
if( xl >= pix->width )
|
||||
{
|
||||
xl = 0;
|
||||
yl += h;
|
||||
}
|
||||
}
|
||||
|
||||
FS_FreeImage( pix );
|
||||
Mem_Free( temp.buffer );
|
||||
mod->type = mod_sprite; // done
|
||||
}
|
||||
|
||||
void Mod_UnloadSpriteModel( model_t *mod )
|
||||
{
|
||||
msprite_t *psprite;
|
||||
mspritegroup_t *pspritegroup;
|
||||
mspriteframe_t *pspriteframe;
|
||||
int i, j;
|
||||
|
||||
ASSERT( mod != NULL );
|
||||
|
||||
if( mod->type != mod_sprite )
|
||||
return; // not a sprite
|
||||
|
||||
psprite = mod->cache.data;
|
||||
if( !psprite ) return; // already freed
|
||||
|
||||
// release all textures
|
||||
for( i = 0; i < psprite->numframes; i++ )
|
||||
{
|
||||
if( psprite->frames[i].type == SPR_SINGLE )
|
||||
{
|
||||
pspriteframe = psprite->frames[i].frameptr;
|
||||
GL_FreeTexture( pspriteframe->gl_texturenum );
|
||||
}
|
||||
else
|
||||
{
|
||||
pspritegroup = (mspritegroup_t *)psprite->frames[i].frameptr;
|
||||
|
||||
for( j = 0; j < pspritegroup->numframes; j++ )
|
||||
{
|
||||
pspriteframe = pspritegroup->frames[i];
|
||||
GL_FreeTexture( pspriteframe->gl_texturenum );
|
||||
}
|
||||
}
|
||||
}
|
||||
Mem_FreePool( &mod->mempool );
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
R_GetSpriteFrame
|
||||
|
||||
assume pModel is valid
|
||||
================
|
||||
*/
|
||||
mspriteframe_t *R_GetSpriteFrame( const model_t *pModel, int frame, float yaw )
|
||||
{
|
||||
msprite_t *psprite;
|
||||
mspritegroup_t *pspritegroup;
|
||||
mspriteframe_t *pspriteframe;
|
||||
float *pintervals, fullinterval;
|
||||
float targettime, time;
|
||||
int i, numframes;
|
||||
|
||||
ASSERT( pModel );
|
||||
psprite = pModel->cache.data;
|
||||
|
||||
if( frame < 0 ) frame = 0;
|
||||
else if( frame >= psprite->numframes )
|
||||
{
|
||||
MsgDev( D_WARN, "R_GetSpriteFrame: no such frame %d (%s)\n", frame, pModel->name );
|
||||
frame = psprite->numframes - 1;
|
||||
}
|
||||
|
||||
if( psprite->frames[frame].type == SPR_SINGLE )
|
||||
{
|
||||
pspriteframe = psprite->frames[frame].frameptr;
|
||||
}
|
||||
else if( psprite->frames[frame].type == SPR_GROUP )
|
||||
{
|
||||
pspritegroup = (mspritegroup_t *)psprite->frames[frame].frameptr;
|
||||
pintervals = pspritegroup->intervals;
|
||||
numframes = pspritegroup->numframes;
|
||||
fullinterval = pintervals[numframes-1];
|
||||
time = cl.time;
|
||||
|
||||
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval values
|
||||
// are positive, so we don't have to worry about division by zero
|
||||
targettime = time - ((int)(time / fullinterval)) * fullinterval;
|
||||
|
||||
for( i = 0; i < (numframes - 1); i++ )
|
||||
{
|
||||
if( pintervals[i] > targettime )
|
||||
break;
|
||||
}
|
||||
pspriteframe = pspritegroup->frames[i];
|
||||
}
|
||||
else if( psprite->frames[frame].type == FRAME_ANGLED )
|
||||
{
|
||||
int angleframe = (int)(( RI.refdef.viewangles[1] - yaw ) / 360 * 8 + 0.5 - 4) & 7;
|
||||
|
||||
// e.g. doom-style sprite monsters
|
||||
pspritegroup = (mspritegroup_t *)psprite->frames[frame].frameptr;
|
||||
pspriteframe = pspritegroup->frames[angleframe];
|
||||
}
|
||||
return pspriteframe;
|
||||
}
|
|
@ -41,6 +41,7 @@ convar_t *gl_clear;
|
|||
|
||||
convar_t *r_width;
|
||||
convar_t *r_height;
|
||||
convar_t *r_speeds;
|
||||
|
||||
convar_t *vid_displayfrequency;
|
||||
convar_t *vid_fullscreen;
|
||||
|
@ -628,7 +629,7 @@ static int GL_ChoosePFD( int colorBits, int depthBits, int stencilBits )
|
|||
uint flags = PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER;
|
||||
int i, numPFDs, pixelFormat = 0;
|
||||
|
||||
MsgDev( D_INFO, "GL_ChoosePFD( color %i, depth %i, stencil %i )\n", colorBits, depthBits, stencilBits );
|
||||
MsgDev( D_NOTE, "GL_ChoosePFD( color %i, depth %i, stencil %i )\n", colorBits, depthBits, stencilBits );
|
||||
|
||||
// Count PFDs
|
||||
if( glw_state.minidriver )
|
||||
|
@ -1181,16 +1182,6 @@ qboolean R_Init_OpenGL( void )
|
|||
Sys_LoadLibrary( NULL, &opengl_dll ); // load opengl32.dll
|
||||
if( !opengl_dll.link ) return false;
|
||||
|
||||
// initialize gl extensions
|
||||
GL_CheckExtension( "OpenGL 1.1.0", opengl_110funcs, NULL, GL_OPENGL_110 );
|
||||
|
||||
// get our various GL strings
|
||||
glConfig.vendor_string = pglGetString( GL_VENDOR );
|
||||
glConfig.renderer_string = pglGetString( GL_RENDERER );
|
||||
glConfig.version_string = pglGetString( GL_VERSION );
|
||||
glConfig.extensions_string = pglGetString( GL_EXTENSIONS );
|
||||
MsgDev( D_INFO, "Video: %s\n", glConfig.renderer_string );
|
||||
|
||||
if(( err = R_ChangeDisplaySettings( vid_mode->integer, fullscreen )) == rserr_ok )
|
||||
{
|
||||
glConfig.prev_mode = vid_mode->integer;
|
||||
|
@ -1275,10 +1266,10 @@ static void GL_SetDefaults( void )
|
|||
GL_Cull( 0 );
|
||||
GL_FrontFace( 0 );
|
||||
|
||||
// GL_SetState( GLSTATE_DEPTHWRITE );
|
||||
GL_SetState( GLSTATE_DEPTHWRITE );
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
|
||||
// R_SetTextureParameters();
|
||||
R_SetTextureParameters();
|
||||
|
||||
pglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
|
||||
pglTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
|
@ -1332,6 +1323,7 @@ void GL_InitCommands( void )
|
|||
// system screen width and height (don't suppose for change from console at all)
|
||||
r_width = Cvar_Get( "width", "640", CVAR_READ_ONLY, "screen width" );
|
||||
r_height = Cvar_Get( "height", "480", CVAR_READ_ONLY, "screen height" );
|
||||
r_speeds = Cvar_Get( "r_speeds", "0", CVAR_ARCHIVE, "shows renderer speeds" );
|
||||
|
||||
gl_picmip = Cvar_Get( "gl_picmip", "0", CVAR_RENDERINFO|CVAR_LATCH_VIDEO, "reduces resolution of textures by powers of 2" );
|
||||
gl_skymip = Cvar_Get( "gl_skymip", "0", CVAR_RENDERINFO|CVAR_LATCH_VIDEO, "reduces resolution of skybox textures by powers of 2" );
|
||||
|
@ -1365,23 +1357,35 @@ void GL_InitCommands( void )
|
|||
vid_displayfrequency = Cvar_Get ( "vid_displayfrequency", "0", CVAR_RENDERINFO|CVAR_LATCH_VIDEO, "fullscreen refresh rate" );
|
||||
|
||||
Cmd_AddCommand( "r_info", R_RenderInfo_f, "display renderer info" );
|
||||
Cmd_AddCommand( "texturelist", R_TextureList_f, "display loaded textures list" );
|
||||
}
|
||||
|
||||
void GL_RemoveCommands( void )
|
||||
{
|
||||
Cmd_RemoveCommand( "r_info");
|
||||
Cmd_RemoveCommand( "texturelist" );
|
||||
}
|
||||
|
||||
void GL_InitExtensions( void )
|
||||
{
|
||||
int flags = 0;
|
||||
|
||||
// initialize gl extensions
|
||||
GL_CheckExtension( "OpenGL 1.1.0", opengl_110funcs, NULL, GL_OPENGL_110 );
|
||||
|
||||
// get our various GL strings
|
||||
glConfig.vendor_string = pglGetString( GL_VENDOR );
|
||||
glConfig.renderer_string = pglGetString( GL_RENDERER );
|
||||
glConfig.version_string = pglGetString( GL_VERSION );
|
||||
glConfig.extensions_string = pglGetString( GL_EXTENSIONS );
|
||||
MsgDev( D_INFO, "Video: %s\n", glConfig.renderer_string );
|
||||
|
||||
GL_CheckExtension( "WGL_3DFX_gamma_control", wgl3DFXgammacontrolfuncs, NULL, GL_WGL_3DFX_GAMMA_CONTROL );
|
||||
GL_CheckExtension( "WGL_EXT_swap_control", wglswapintervalfuncs, NULL, GL_WGL_SWAPCONTROL );
|
||||
GL_CheckExtension( "glDrawRangeElements", drawrangeelementsfuncs, "gl_drawrangeelments", GL_DRAW_RANGEELEMENTS_EXT );
|
||||
|
||||
if( !GL_Support( GL_DRAW_RANGEELEMENTS_EXT ))
|
||||
GL_CheckExtension("GL_EXT_draw_range_elements", drawrangeelementsextfuncs, "gl_drawrangeelments", GL_DRAW_RANGEELEMENTS_EXT );
|
||||
GL_CheckExtension( "GL_EXT_draw_range_elements", drawrangeelementsextfuncs, "gl_drawrangeelments", GL_DRAW_RANGEELEMENTS_EXT );
|
||||
|
||||
// multitexture
|
||||
glConfig.max_texture_units = 1;
|
||||
|
@ -1526,18 +1530,21 @@ R_Init
|
|||
*/
|
||||
qboolean R_Init( void )
|
||||
{
|
||||
r_temppool = Mem_AllocPool( "Render Zone" );
|
||||
if( glw_state.initialized ) return true;
|
||||
|
||||
GL_InitCommands();
|
||||
GL_SetDefaultState();
|
||||
|
||||
// create the window and set up the context
|
||||
if( !R_Init_OpenGL())
|
||||
if( !R_Init_OpenGL( ))
|
||||
{
|
||||
GL_RemoveCommands();
|
||||
R_Free_OpenGL();
|
||||
return false;
|
||||
}
|
||||
|
||||
r_temppool = Mem_AllocPool( "Render Zone" );
|
||||
|
||||
GL_InitExtensions();
|
||||
GL_SetDefaults();
|
||||
R_InitImages();
|
||||
|
@ -1555,6 +1562,9 @@ R_Shutdown
|
|||
*/
|
||||
void R_Shutdown( void )
|
||||
{
|
||||
if( !glw_state.initialized )
|
||||
return;
|
||||
|
||||
GL_RemoveCommands();
|
||||
R_ShutdownImages();
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
//=======================================================================
|
||||
// Copyright XashXT Group 2010 ©
|
||||
// gl_warp.c - sky and water polygons
|
||||
//=======================================================================
|
||||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "gl_local.h"
|
||||
|
||||
/*
|
||||
===============
|
||||
R_SetupSky
|
||||
===============
|
||||
*/
|
||||
void R_SetupSky( const char *skyboxname )
|
||||
{
|
||||
}
|
|
@ -83,7 +83,6 @@ void Mod_GetBounds( int handle, vec3_t mins, vec3_t maxs );
|
|||
void Mod_GetFrames( int handle, int *numFrames );
|
||||
modtype_t CM_GetModelType( int handle );
|
||||
model_t *CM_ClipHandleToModel( int handle );
|
||||
int CM_ClipModelToHandle( const model_t *pmodel );
|
||||
void CM_BeginRegistration ( const char *name, qboolean clientload, uint *checksum );
|
||||
model_t *CM_ModForName( const char *name, qboolean world );
|
||||
qboolean CM_RegisterModel( const char *name, int index );
|
||||
|
|
|
@ -11,12 +11,34 @@ extern "C" {
|
|||
|
||||
// linked interfaces
|
||||
extern stdlib_api_t com;
|
||||
extern render_exp_t *re;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define TF_FONT (TF_UNCOMPRESSED|TF_NOPICMIP|TF_NOMIPMAP|TF_CLAMP)
|
||||
#define TF_IMAGE (TF_UNCOMPRESSED|TF_NOPICMIP|TF_NOMIPMAP)
|
||||
#define TF_DECAL (TF_CLAMP|TF_UNCOMPRESSED)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
TF_STATIC = BIT(0), // don't free until Shader_FreeUnused()
|
||||
TF_NOPICMIP = BIT(1), // ignore r_picmip resample rules
|
||||
TF_UNCOMPRESSED = BIT(2), // don't compress texture in video memory
|
||||
TF_CUBEMAP = BIT(3), // it's cubemap texture
|
||||
TF_DEPTHMAP = BIT(4), // custom texture filter used
|
||||
TF_INTENSITY = BIT(5),
|
||||
TF_LUMINANCE = BIT(6), // force image to grayscale
|
||||
TF_SKYSIDE = BIT(7),
|
||||
TF_CLAMP = BIT(8),
|
||||
TF_NOMIPMAP = BIT(9),
|
||||
TF_NEAREST = BIT(10), // disable texfilter
|
||||
TF_LIGHTMAP = BIT(11), // no resample etc
|
||||
TF_HAS_LUMA = BIT(12), // sets by GL_UploadTexture
|
||||
TF_MAKELUMA = BIT(13), // create luma from quake texture
|
||||
TF_NORMALMAP = BIT(14), // is a normalmap
|
||||
} texFlags_t;
|
||||
|
||||
qboolean R_Init( void );
|
||||
void R_Shutdown( void );
|
||||
int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags );
|
||||
|
@ -28,11 +50,30 @@ void R_BeginFrame( qboolean clearScene );
|
|||
void R_RenderFrame( const ref_params_t *fd, qboolean drawWorld );
|
||||
void R_EndFrame( void );
|
||||
void R_ClearScene( void );
|
||||
void R_GetTextureParms( int *w, int *h, int texnum );
|
||||
void R_GetSpriteParms( int *frameWidth, int *frameHeight, int *numFrames, int curFrame, const struct model_s *pSprite );
|
||||
void R_DrawStretchRaw( float x, float y, float w, float h, int cols, int rows, const byte *data, qboolean dirty );
|
||||
void R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, int texnum );
|
||||
void R_DrawSetColor( const rgba_t color );
|
||||
|
||||
|
||||
qboolean R_SpeedsMessage( char *out, size_t size );
|
||||
int R_CreateDecalList( decallist_t *pList, qboolean changelevel );
|
||||
void R_SetupSky( const char *skyboxname );
|
||||
qboolean R_CullBox( const vec3_t mins, const vec3_t maxs );
|
||||
qboolean R_WorldToScreen( const vec3_t point, vec3_t screen );
|
||||
void R_ScreenToWorld( const vec3_t screen, vec3_t point );
|
||||
qboolean R_AddEntity( struct cl_entity_s *pRefEntity, int entityType, int customTexture );
|
||||
void Mod_LoadSpriteModel( struct model_s *mod, const void *buffer );
|
||||
void Mod_LoadMapSprite( struct model_s *mod, const void *buffer, size_t size );
|
||||
void Mod_UnloadSpriteModel( struct model_s *mod );
|
||||
void GL_SetRenderMode( int mode );
|
||||
int R_GetSpriteTexture( const struct model_s *m_pSpriteModel, int frame );
|
||||
void R_LightForPoint( const vec3_t point, vec3_t ambientLight );
|
||||
qboolean R_AddDLight( vec3_t pos, color24 color, float radius, int flags );
|
||||
qboolean R_SetLightStyle( int stylenum, vec3_t color );
|
||||
qboolean R_DecalShoot( int texture, int ent, int model, vec3_t pos, vec3_t saxis, int flags, rgba_t color );
|
||||
void R_DecalRemoveAll( int texture );
|
||||
byte *Mod_GetCurrentVis( void );
|
||||
|
||||
typedef int sound_t;
|
||||
|
||||
typedef struct
|
||||
|
|
|
@ -131,10 +131,6 @@ typedef struct host_parm_s
|
|||
int window_center_x;
|
||||
int window_center_y;
|
||||
|
||||
// renderers info
|
||||
char *video_dlls[MAX_RENDERS];
|
||||
int num_video_dlls;
|
||||
|
||||
decallist_t *decalList; // used for keep decals, when renderer is restarted or changed
|
||||
int numdecals;
|
||||
|
||||
|
@ -159,7 +155,6 @@ void Host_SetServerState( int state );
|
|||
int Host_ServerState( void );
|
||||
int Host_CompareFileTime( long ft1, long ft2 );
|
||||
qboolean Host_NewGame( const char *mapName, qboolean loadGame );
|
||||
int Host_CreateDecalList( decallist_t *pList, qboolean changelevel );
|
||||
void Host_EndGame( const char *message, ... );
|
||||
void Host_AbortCurrentFrame( void );
|
||||
void Host_WriteServerConfig( const char *name );
|
||||
|
@ -285,6 +280,7 @@ void COM_AddAppDirectoryToSearchPath( const char *pszBaseDir, const char *appNam
|
|||
int COM_ExpandFilename( const char *fileName, char *nameOutBuffer, int nameOutBufferSize );
|
||||
struct pmtrace_s *PM_TraceLine( float *start, float *end, int flags, int usehull, int ignore_pe );
|
||||
void SV_StartSound( edict_t *ent, int chan, const char *sample, float vol, float attn, int flags, int pitch );
|
||||
int R_CreateDecalList( decallist_t *pList, qboolean changelevel );
|
||||
struct cl_entity_s *CL_GetEntityByIndex( int index );
|
||||
struct cl_entity_s *CL_GetLocalPlayer( void );
|
||||
struct player_info_s *CL_GetPlayerInfo( int playerIndex );
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "keydefs.h"
|
||||
#include "protocol.h" // get the protocol version
|
||||
#include "con_nprint.h"
|
||||
#include "gl_local.h"
|
||||
#include "qfont.h"
|
||||
|
||||
convar_t *con_notifytime;
|
||||
|
@ -210,7 +211,7 @@ void Con_CheckResize( void )
|
|||
if( width == con.linewidth )
|
||||
return;
|
||||
|
||||
if( re == NULL )
|
||||
if( !glw_state.initialized )
|
||||
{
|
||||
// video hasn't been initialized yet
|
||||
width = g_console_field_width;
|
||||
|
@ -330,14 +331,12 @@ static void Con_LoadConchars( void )
|
|||
else if( scr_width->integer >= 1280 ) Cvar_SetFloat( "con_fontsize", 2 );
|
||||
else Cvar_SetFloat( "con_fontsize", 1 );
|
||||
|
||||
if( !re ) return;
|
||||
|
||||
// loading conchars
|
||||
con.chars.hFontTexture = re->RegisterShader( va( "fonts/font%i", con_fontsize->integer ), SHADER_NOMIP );
|
||||
con.chars.hFontTexture = GL_LoadTexture( va( "fonts/font%i", con_fontsize->integer ), NULL, 0, TF_FONT );
|
||||
|
||||
if( !con_fontsize->modified ) return; // font not changed
|
||||
|
||||
re->GetParms( &fontWidth, &fontHeight, NULL, 0, con.chars.hFontTexture );
|
||||
R_GetTextureParms( &fontWidth, &fontHeight, con.chars.hFontTexture );
|
||||
|
||||
// setup creditsfont
|
||||
if( FS_FileExists( va( "fonts/font%i.fnt", con_fontsize->integer ) ))
|
||||
|
@ -388,8 +387,8 @@ static int Con_DrawGenericChar( int x, int y, int number, rgba_t color )
|
|||
|
||||
rc = &con.chars.fontRc[number];
|
||||
|
||||
re->SetColor( color );
|
||||
re->GetParms( &width, &height, NULL, 0, con.chars.hFontTexture );
|
||||
R_DrawSetColor( color );
|
||||
R_GetTextureParms( &width, &height, con.chars.hFontTexture );
|
||||
|
||||
// calc rectangle
|
||||
s1 = (float)rc->left / width;
|
||||
|
@ -399,15 +398,15 @@ static int Con_DrawGenericChar( int x, int y, int number, rgba_t color )
|
|||
width = rc->right - rc->left;
|
||||
height = rc->bottom - rc->top;
|
||||
|
||||
re->DrawStretchPic( x, y, width, height, s1, t1, s2, t2, con.chars.hFontTexture );
|
||||
re->SetColor( NULL ); // don't forget reset color
|
||||
R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, con.chars.hFontTexture );
|
||||
R_DrawSetColor( NULL ); // don't forget reset color
|
||||
|
||||
return con.charWidths[number];
|
||||
}
|
||||
|
||||
static int Con_DrawCharacter( int x, int y, int number, rgba_t color )
|
||||
{
|
||||
re->SetParms( con.chars.hFontTexture, kRenderTransTexture, 0 );
|
||||
GL_SetRenderMode( kRenderTransTexture );
|
||||
return Con_DrawGenericChar( x, y, number, color );
|
||||
}
|
||||
|
||||
|
@ -495,7 +494,7 @@ int Con_DrawGenericString( int x, int y, const char *string, rgba_t setColor, qb
|
|||
s++;
|
||||
}
|
||||
|
||||
re->SetColor( NULL );
|
||||
R_DrawSetColor( NULL );
|
||||
return drawLen;
|
||||
}
|
||||
|
||||
|
@ -1203,7 +1202,7 @@ void Con_DrawInput( void )
|
|||
if( host.key_overstrike && cursorChar )
|
||||
{
|
||||
// overstrike cursor
|
||||
re->SetParms( con.chars.hFontTexture, kRenderTransInverse, 0 );
|
||||
GL_SetRenderMode( kRenderTransInverse );
|
||||
Con_DrawGenericChar( x + curPos, y, cursorChar, colorDefault );
|
||||
}
|
||||
else Con_DrawCharacter( x + curPos, y, '_', colorDefault );
|
||||
|
@ -1226,7 +1225,7 @@ void Con_DrawNotify( void )
|
|||
if( !host.developer ) return;
|
||||
|
||||
currentColor = 7;
|
||||
re->SetColor( g_color_table[currentColor] );
|
||||
R_DrawSetColor( g_color_table[currentColor] );
|
||||
|
||||
for( i = con.current - CON_TIMES + 1; i <= con.current; i++ )
|
||||
{
|
||||
|
@ -1249,7 +1248,7 @@ void Con_DrawNotify( void )
|
|||
}
|
||||
v += con.charHeight;
|
||||
}
|
||||
re->SetColor( NULL );
|
||||
R_DrawSetColor( NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1279,8 +1278,8 @@ void Con_DrawSolidConsole( float frac )
|
|||
|
||||
if( y >= 1 )
|
||||
{
|
||||
re->SetParms( con.background, kRenderNormal, 0 );
|
||||
re->DrawStretchPic( 0, y - scr_height->integer, scr_width->integer, scr_height->integer, 0, 0, 1, 1, con.background );
|
||||
GL_SetRenderMode( kRenderNormal );
|
||||
R_DrawStretchPic( 0, y - scr_height->integer, scr_width->integer, scr_height->integer, 0, 0, 1, 1, con.background );
|
||||
}
|
||||
else y = 0;
|
||||
|
||||
|
@ -1320,7 +1319,7 @@ void Con_DrawSolidConsole( float frac )
|
|||
if( con.x == 0 ) row--;
|
||||
|
||||
currentColor = 7;
|
||||
re->SetColor( g_color_table[currentColor] );
|
||||
R_DrawSetColor( g_color_table[currentColor] );
|
||||
|
||||
for( i = 0; i < rows; i++, y -= con.charHeight, row-- )
|
||||
{
|
||||
|
@ -1344,7 +1343,7 @@ void Con_DrawSolidConsole( float frac )
|
|||
|
||||
// draw the input prompt, user text, and cursor if desired
|
||||
Con_DrawInput();
|
||||
re->SetColor( NULL );
|
||||
R_DrawSetColor( NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1480,22 +1479,20 @@ void Con_VidInit( void )
|
|||
g_console_field_width = ( scr_width->integer / 8 ) - 2;
|
||||
con.input.widthInChars = g_console_field_width;
|
||||
|
||||
if( !re ) return;
|
||||
|
||||
// loading console image
|
||||
if( host.developer )
|
||||
{
|
||||
if( scr_width->integer < 640 )
|
||||
{
|
||||
if( FS_FileExists( "cached/conback400" ))
|
||||
con.background = re->RegisterShader( "cached/conback400", SHADER_NOMIP );
|
||||
else con.background = re->RegisterShader( "cached/conback", SHADER_NOMIP );
|
||||
con.background = GL_LoadTexture( "cached/conback400", NULL, 0, TF_IMAGE );
|
||||
else con.background = GL_LoadTexture( "cached/conback", NULL, 0, TF_IMAGE );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( FS_FileExists( "cached/conback640" ))
|
||||
con.background = re->RegisterShader( "cached/conback640", SHADER_NOMIP );
|
||||
else con.background = re->RegisterShader( "cached/conback", SHADER_NOMIP );
|
||||
con.background = GL_LoadTexture( "cached/conback640", NULL, 0, TF_IMAGE );
|
||||
else con.background = GL_LoadTexture( "cached/conback", NULL, 0, TF_IMAGE );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1503,14 +1500,14 @@ void Con_VidInit( void )
|
|||
if( scr_width->integer < 640 )
|
||||
{
|
||||
if( FS_FileExists( "cached/loading400" ))
|
||||
con.background = re->RegisterShader( "cached/loading400", SHADER_NOMIP );
|
||||
else con.background = re->RegisterShader( "cached/loading", SHADER_NOMIP );
|
||||
con.background = GL_LoadTexture( "cached/loading400", NULL, 0, TF_IMAGE );
|
||||
else con.background = GL_LoadTexture( "cached/loading", NULL, 0, TF_IMAGE );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( FS_FileExists( "cached/loading640" ))
|
||||
con.background = re->RegisterShader( "cached/loading640", SHADER_NOMIP );
|
||||
else con.background = re->RegisterShader( "cached/loading", SHADER_NOMIP );
|
||||
con.background = GL_LoadTexture( "cached/loading640", NULL, 0, TF_IMAGE );
|
||||
else con.background = GL_LoadTexture( "cached/loading", NULL, 0, TF_IMAGE );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,11 +8,8 @@
|
|||
#include "cm_local.h"
|
||||
#include "input.h"
|
||||
|
||||
render_exp_t *re;
|
||||
host_parm_t host; // host parms
|
||||
stdlib_api_t com, newcom;
|
||||
|
||||
dll_info_t render_dll = { "", NULL, "CreateAPI", NULL, NULL, 0, sizeof(render_exp_t), sizeof(stdlib_api_t) };
|
||||
stdlib_api_t com;
|
||||
|
||||
convar_t *host_serverstate;
|
||||
convar_t *host_gameloaded;
|
||||
|
@ -20,11 +17,14 @@ convar_t *host_limitlocal;
|
|||
convar_t *host_cheats;
|
||||
convar_t *host_maxfps;
|
||||
convar_t *host_framerate;
|
||||
convar_t *host_video;
|
||||
qboolean sound_restart;
|
||||
qboolean video_restart;
|
||||
|
||||
// these cvars will be duplicated on each client across network
|
||||
int Host_ServerState( void ) { return Cvar_VariableInteger( "host_serverstate" ); }
|
||||
int Host_ServerState( void )
|
||||
{
|
||||
return Cvar_VariableInteger( "host_serverstate" );
|
||||
}
|
||||
|
||||
int Host_CompareFileTime( long ft1, long ft2 )
|
||||
{
|
||||
|
@ -95,72 +95,8 @@ void Host_EndGame( const char *message, ... )
|
|||
Host_AbortCurrentFrame ();
|
||||
}
|
||||
|
||||
static void Host_DrawDebugCollision( cmdraw_t drawPoly )
|
||||
{
|
||||
if( !drawPoly ) return;
|
||||
|
||||
// FIXME: get collision polys here
|
||||
}
|
||||
|
||||
int Host_CreateDecalList( decallist_t *pList, qboolean changelevel )
|
||||
{
|
||||
if( !re ) return 0;
|
||||
|
||||
return re->CreateDecalList( pList, changelevel );
|
||||
}
|
||||
|
||||
void Host_FreeRender( void )
|
||||
{
|
||||
if( render_dll.link )
|
||||
{
|
||||
SCR_Shutdown ();
|
||||
re->Shutdown( true );
|
||||
Mem_Set( &re, 0, sizeof( re ));
|
||||
}
|
||||
Sys_FreeLibrary( &render_dll );
|
||||
}
|
||||
|
||||
qboolean Host_InitRender( void )
|
||||
{
|
||||
static render_imp_t ri;
|
||||
launch_t CreateRender;
|
||||
qboolean result = false;
|
||||
|
||||
ri.api_size = sizeof( render_imp_t );
|
||||
|
||||
// studio callbacks
|
||||
ri.UpdateScreen = SCR_UpdateScreen;
|
||||
ri.StudioEvent = CL_StudioEvent;
|
||||
ri.ShowCollision = Host_DrawDebugCollision;
|
||||
ri.GetClientEdict = CL_GetEntityByIndex;
|
||||
ri.GetPlayerInfo = CL_GetPlayerInfo;
|
||||
ri.GetLocalPlayer = CL_GetLocalPlayer;
|
||||
ri.GetMaxClients = CL_GetMaxClients;
|
||||
ri.DrawTriangles = Tri_DrawTriangles;
|
||||
ri.ExtraUpdate = CL_ExtraUpdate;
|
||||
ri.GetLerpFrac = CL_GetLerpFrac;
|
||||
ri.IsThirdPerson = CL_IsThirdPerson;
|
||||
ri.WndProc = IN_WndProc;
|
||||
|
||||
Sys_LoadLibrary( host_video->string, &render_dll );
|
||||
|
||||
if( render_dll.link )
|
||||
{
|
||||
CreateRender = (void *)render_dll.main;
|
||||
re = CreateRender( &newcom, &ri );
|
||||
|
||||
if( re->Init( true )) result = true;
|
||||
}
|
||||
|
||||
// video system not started, shutdown refresh subsystem
|
||||
if( !result ) Host_FreeRender();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void Host_CheckChanges( void )
|
||||
{
|
||||
int num_changes;
|
||||
qboolean audio_disabled = false;
|
||||
|
||||
if( FS_CheckParm( "-nosound" ))
|
||||
|
@ -170,23 +106,25 @@ void Host_CheckChanges( void )
|
|||
sound_restart = false;
|
||||
}
|
||||
|
||||
if( host_video->modified || sound_restart )
|
||||
if( video_restart || sound_restart )
|
||||
{
|
||||
if( host_video->modified ) CL_ForceVid();
|
||||
if( video_restart ) CL_ForceVid();
|
||||
if( sound_restart ) CL_ForceSnd();
|
||||
}
|
||||
else return;
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
num_changes = 0;
|
||||
|
||||
if( host_video->modified && CL_Active( ))
|
||||
if( video_restart && CL_Active( ))
|
||||
{
|
||||
// we're in game and want keep decals when renderer is changed
|
||||
host.decalList = (decallist_t *)Z_Malloc( sizeof( decallist_t ) * MAX_RENDER_DECALS );
|
||||
host.numdecals = Host_CreateDecalList( host.decalList, false );
|
||||
host.numdecals = R_CreateDecalList( host.decalList, false );
|
||||
Msg( "Total stored %i decals\n", host.numdecals );
|
||||
}
|
||||
|
||||
if(( host_video->modified || sound_restart ) && CL_Active( ))
|
||||
if(( video_restart || sound_restart ) && CL_Active( ))
|
||||
{
|
||||
host.soundList = (soundlist_t *)Z_Malloc( sizeof( soundlist_t ) * 128 );
|
||||
host.numsounds = S_GetCurrentStaticSounds( host.soundList, 128, CHAN_STATIC );
|
||||
|
@ -195,31 +133,22 @@ void Host_CheckChanges( void )
|
|||
|
||||
S_StopAllSounds(); // don't let them loop during the restart
|
||||
|
||||
// restart or change renderer
|
||||
while( host_video->modified )
|
||||
// restart renderer
|
||||
if( video_restart )
|
||||
{
|
||||
host_video->modified = false; // predict state
|
||||
R_Shutdown();
|
||||
|
||||
Host_FreeRender(); // release render.dll
|
||||
if( !Host_InitRender( )) // load it again
|
||||
if( !R_Init( ))
|
||||
{
|
||||
if( num_changes > host.num_video_dlls )
|
||||
{
|
||||
Sys_NewInstance( va("#%s", GI->gamefolder ), "fallback to dedicated mode\n" );
|
||||
return;
|
||||
}
|
||||
if( !com.strcmp( host.video_dlls[num_changes], host_video->string ))
|
||||
num_changes++; // already trying - failed
|
||||
Cvar_FullSet( "host_video", host.video_dlls[num_changes], CVAR_INIT|CVAR_ARCHIVE );
|
||||
num_changes++;
|
||||
Sys_NewInstance( va("#%s", GI->gamefolder ), "fallback to dedicated mode\n" );
|
||||
return;
|
||||
}
|
||||
else SCR_Init ();
|
||||
video_restart = false;
|
||||
}
|
||||
|
||||
if( audio_disabled ) MsgDev( D_INFO, "Audio: Disabled\n" );
|
||||
|
||||
num_changes = 0;
|
||||
|
||||
// restart sound engine
|
||||
if( sound_restart )
|
||||
{
|
||||
|
@ -260,7 +189,7 @@ Restart the video subsystem
|
|||
*/
|
||||
void Host_VidRestart_f( void )
|
||||
{
|
||||
host_video->modified = true;
|
||||
video_restart = true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -690,15 +619,6 @@ static void Host_Crash_f( void )
|
|||
|
||||
void Host_InitCommon( const int argc, const char **argv )
|
||||
{
|
||||
dll_info_t check_vid;
|
||||
search_t *dlls;
|
||||
int i;
|
||||
|
||||
newcom = com;
|
||||
|
||||
// overload some funcs
|
||||
newcom.error = Host_Error;
|
||||
|
||||
// get developer mode
|
||||
host.developer = SI->developer;
|
||||
|
||||
|
@ -715,37 +635,6 @@ void Host_InitCommon( const int argc, const char **argv )
|
|||
Host_InitDecals();
|
||||
|
||||
IN_Init();
|
||||
|
||||
// initialize video multi-dlls system
|
||||
host.num_video_dlls = 0;
|
||||
|
||||
// make sure what global copy has no changed with any dll checking
|
||||
Mem_Copy( &check_vid, &render_dll, sizeof( dll_info_t ));
|
||||
|
||||
// checking dlls don't invoke crash!
|
||||
check_vid.crash = false;
|
||||
|
||||
dlls = FS_Search( "*.dll", true );
|
||||
|
||||
// couldn't find any dlls, render is missing (but i'm don't know how laucnher find engine :)
|
||||
// probably this should never happen
|
||||
if( !dlls ) Sys_NewInstance( "©", "" );
|
||||
|
||||
for( i = 0; i < dlls->numfilenames; i++ )
|
||||
{
|
||||
if( !com.strnicmp( "vid_", dlls->filenames[i], 4 ))
|
||||
{
|
||||
// make sure what found library is valid
|
||||
if( Sys_LoadLibrary( dlls->filenames[i], &check_vid ))
|
||||
{
|
||||
MsgDev( D_NOTE, "Video[%i]: %s\n", host.num_video_dlls, dlls->filenames[i] );
|
||||
host.video_dlls[host.num_video_dlls] = copystring( dlls->filenames[i] );
|
||||
Sys_FreeLibrary( &check_vid );
|
||||
host.num_video_dlls++;
|
||||
}
|
||||
}
|
||||
}
|
||||
Mem_Free( dlls );
|
||||
}
|
||||
|
||||
void Host_FreeCommon( void )
|
||||
|
@ -776,7 +665,6 @@ void Host_Init( const int argc, const char **argv )
|
|||
Cmd_AddCommand ( "net_error", Net_Error_f, "send network bad message from random place");
|
||||
}
|
||||
|
||||
host_video = Cvar_Get( "host_video", "vid_gl.dll", CVAR_INIT|CVAR_ARCHIVE, "name of video rendering library");
|
||||
host_cheats = Cvar_Get( "sv_cheats", "0", CVAR_LATCH, "allow cheat variables to enable" );
|
||||
host_maxfps = Cvar_Get( "fps_max", "72", CVAR_ARCHIVE, "host fps upper limit" );
|
||||
host_framerate = Cvar_Get( "host_framerate", "0", 0, "locks frame timing to this value in seconds" );
|
||||
|
@ -790,6 +678,7 @@ void Host_Init( const int argc, const char **argv )
|
|||
Cvar_Get( "violence_hblood", "1", CVAR_INIT|CVAR_ARCHIVE, "content control disables human blood" );
|
||||
Cvar_Get( "violence_ablood", "1", CVAR_INIT|CVAR_ARCHIVE, "content control disables alien blood" );
|
||||
|
||||
video_restart = true; // initalize renderer
|
||||
sound_restart = true; // initialize sound engine
|
||||
|
||||
if( host.type != HOST_DEDICATED )
|
||||
|
@ -868,7 +757,7 @@ void Host_Free( void )
|
|||
com.strncpy( host.finalmsg, "Server shutdown\n", MAX_STRING );
|
||||
|
||||
Mod_Shutdown();
|
||||
Host_FreeRender();
|
||||
R_Shutdown();
|
||||
S_Shutdown();
|
||||
|
||||
SV_Shutdown( false );
|
||||
|
|
|
@ -291,14 +291,23 @@ void Mod_AmbientLevels( const vec3_t p, byte *pvolumes )
|
|||
|
||||
/*
|
||||
================
|
||||
CM_FreeModel
|
||||
Mod_FreeModel
|
||||
================
|
||||
*/
|
||||
static void CM_FreeModel( model_t *mod )
|
||||
static void Mod_FreeModel( model_t *mod )
|
||||
{
|
||||
if( !mod || !mod->mempool )
|
||||
return;
|
||||
|
||||
switch( mod->type )
|
||||
{
|
||||
case mod_sprite:
|
||||
Mod_UnloadSpriteModel( mod );
|
||||
break;
|
||||
case mod_studio:
|
||||
break;
|
||||
}
|
||||
|
||||
Mem_FreePool( &mod->mempool );
|
||||
Mem_Set( mod, 0, sizeof( *mod ));
|
||||
}
|
||||
|
@ -325,7 +334,7 @@ void Mod_Shutdown( void )
|
|||
int i;
|
||||
|
||||
for( i = 0; i < cm_nummodels; i++ )
|
||||
CM_FreeModel( &cm_models[i] );
|
||||
Mod_FreeModel( &cm_models[i] );
|
||||
|
||||
Mem_FreePool( &cm.studiopool );
|
||||
}
|
||||
|
@ -461,6 +470,7 @@ static void Mod_LoadTexInfo( const dlump_t *l )
|
|||
Host_Error( "Mod_LoadTexInfo: bad miptex number in '%s'\n", loadmodel->name );
|
||||
|
||||
out->texture = loadmodel->textures[miptex];
|
||||
out->flags = in->flags;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -594,10 +604,12 @@ static void Mod_LoadSurfaces( const dlump_t *l )
|
|||
// some DMC maps have bad textures
|
||||
if( out->texinfo->texture )
|
||||
{
|
||||
if( !com.strncmp( out->texinfo->texture->name, "sky", 3 ))
|
||||
texture_t *tex = out->texinfo->texture;
|
||||
|
||||
if( !com.strncmp( tex->name, "sky", 3 ))
|
||||
out->flags |= (SURF_DRAWSKY|SURF_DRAWTILED);
|
||||
|
||||
if( out->texinfo->texture->name[0] == '*' || out->texinfo->texture->name[0] == '!' )
|
||||
if( tex->name[0] == '*' || tex->name[0] == '!' || !com.strnicmp( tex->name, "water", 5 ))
|
||||
out->flags |= (SURF_DRAWTURB|SURF_DRAWTILED);
|
||||
}
|
||||
|
||||
|
@ -867,7 +879,8 @@ static void Mod_LoadPlanes( dlump_t *l )
|
|||
for( j = 0; j < 3; j++ )
|
||||
{
|
||||
out->normal[j] = in->normal[j];
|
||||
if( out->normal[j] < 0.0f ) out->signbits |= 1<<j;
|
||||
if( out->normal[j] < 0.0f )
|
||||
out->signbits |= 1<<j;
|
||||
}
|
||||
|
||||
out->dist = in->dist;
|
||||
|
@ -1235,7 +1248,7 @@ model_t *CM_ModForName( const char *name, qboolean world )
|
|||
|
||||
if( mod->type == mod_bad )
|
||||
{
|
||||
CM_FreeModel( mod );
|
||||
Mod_FreeModel( mod );
|
||||
|
||||
// check for loading problems
|
||||
if( world ) Host_Error( "Mod_ForName: %s unknown format\n", name );
|
||||
|
@ -1249,7 +1262,7 @@ model_t *CM_ModForName( const char *name, qboolean world )
|
|||
static void CM_FreeWorld( void )
|
||||
{
|
||||
if( worldmodel )
|
||||
CM_FreeModel( &cm_models[0] );
|
||||
Mod_FreeModel( &cm_models[0] );
|
||||
|
||||
if( cm.entityscript )
|
||||
{
|
||||
|
@ -1319,7 +1332,7 @@ void CM_EndRegistration( void )
|
|||
{
|
||||
if( !mod->name[0] ) continue;
|
||||
if( mod->registration_sequence != cm.registration_sequence )
|
||||
CM_FreeModel( mod );
|
||||
Mod_FreeModel( mod );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1338,23 +1351,6 @@ model_t *CM_ClipHandleToModel( int handle )
|
|||
return sv_models[handle];
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CM_ClipHandleToModel
|
||||
==================
|
||||
*/
|
||||
int CM_ClipModelToHandle( const model_t *pmodel )
|
||||
{
|
||||
int i;
|
||||
|
||||
if( !pmodel ) return 0;
|
||||
|
||||
for( i = 0; i < MAX_MODELS; i++ )
|
||||
if( sv_models[i] == pmodel )
|
||||
return i;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
Mod_GetFrames
|
||||
|
|
|
@ -122,10 +122,6 @@ SOURCE=.\common\build.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\cl_beam.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\cl_cmds.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -154,10 +150,6 @@ SOURCE=.\client\cl_parse.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\cl_part.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\cl_pmove.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -202,6 +194,14 @@ SOURCE=.\client\gl_backend.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\gl_beams.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\gl_decals.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\gl_draw.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -210,18 +210,34 @@ SOURCE=.\client\gl_image.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\gl_rlight.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\gl_rmain.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\gl_rpart.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\gl_rsurf.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\gl_sprite.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\gl_vidnt.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\gl_warp.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\common\host.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -33,14 +33,13 @@ typedef struct ui_enginefuncs_s
|
|||
// image handlers
|
||||
HIMAGE (*pfnPIC_Load)( const char *szPicName, const byte *ucRawImage, long ulRawImageSize );
|
||||
void (*pfnPIC_Free)( const char *szPicName );
|
||||
int (*pfnPIC_Frames)( HIMAGE hPic );
|
||||
int (*pfnPIC_Height)( HIMAGE hPic, int frame );
|
||||
int (*pfnPIC_Width)( HIMAGE hPic, int frame );
|
||||
int (*pfnPIC_Width)( HIMAGE hPic );
|
||||
int (*pfnPIC_Height)( HIMAGE hPic );
|
||||
void (*pfnPIC_Set)( HIMAGE hPic, int r, int g, int b, int a );
|
||||
void (*pfnPIC_Draw)( int frame, int x, int y, int width, int height, const wrect_t *prc );
|
||||
void (*pfnPIC_DrawHoles)( int frame, int x, int y, int width, int height, const wrect_t *prc );
|
||||
void (*pfnPIC_DrawTrans)( int frame, int x, int y, int width, int height, const wrect_t *prc );
|
||||
void (*pfnPIC_DrawAdditive)( int frame, int x, int y, int width, int height, const wrect_t *prc );
|
||||
void (*pfnPIC_Draw)( int x, int y, int width, int height, const wrect_t *prc );
|
||||
void (*pfnPIC_DrawHoles)( int x, int y, int width, int height, const wrect_t *prc );
|
||||
void (*pfnPIC_DrawTrans)( int x, int y, int width, int height, const wrect_t *prc );
|
||||
void (*pfnPIC_DrawAdditive)( int x, int y, int width, int height, const wrect_t *prc );
|
||||
void (*pfnPIC_EnableScissor)( int x, int y, int width, int height );
|
||||
void (*pfnPIC_DisableScissor)( void );
|
||||
|
||||
|
@ -139,7 +138,6 @@ typedef struct ui_enginefuncs_s
|
|||
void (*pfnShellExecute)( const char *name, const char *args, int closeEngine );
|
||||
void (*pfnWriteServerConfig)( const char *name );
|
||||
void (*pfnChangeInstance)( const char *newInstance, const char *szFinalMessage );
|
||||
void (*pfnChangeVideo)( const char *dllName );
|
||||
void (*pfnPlayBackgroundTrack)( const char *introName, const char *loopName );
|
||||
void (*pfnHostEndGame)( const char *szFinalMessage );
|
||||
} ui_enginefuncs_t;
|
||||
|
|
|
@ -917,7 +917,7 @@ void SV_SaveClientState( SAVERESTOREDATA *pSaveData, const char *level )
|
|||
FS_Write( pFile, &version, sizeof( int ));
|
||||
|
||||
decalList = (decallist_t *)Z_Malloc(sizeof( decallist_t ) * MAX_RENDER_DECALS );
|
||||
decalCount = Host_CreateDecalList( decalList, svgame.globals->changelevel );
|
||||
decalCount = R_CreateDecalList( decalList, svgame.globals->changelevel );
|
||||
|
||||
FS_Write( pFile, &decalCount, sizeof( int ));
|
||||
|
||||
|
@ -1740,8 +1740,8 @@ void SV_SaveGame( const char *pName )
|
|||
if( FS_FileExists( va( "save/%s.%s", savename, SI->savshot_ext )))
|
||||
FS_Delete( va( "save/%s.%s", savename, SI->savshot_ext ));
|
||||
|
||||
// HACKHACK: unload previous shader from memory
|
||||
if( re ) re->FreeShader( va( "save/%s.%s", savename, SI->savshot_ext ));
|
||||
// HACKHACK: unload previous image from memory
|
||||
GL_FreeImage( va( "save/%s.%s", savename, SI->savshot_ext ));
|
||||
|
||||
SV_BuildSaveComment( comment, sizeof( comment ));
|
||||
SV_SaveGameSlot( savename, comment );
|
||||
|
|
|
@ -270,7 +270,7 @@ void Image_Init( void )
|
|||
// init pools
|
||||
Sys.imagepool = Mem_AllocPool( "ImageLib Pool" );
|
||||
gl_round_down = Cvar_Get( "gl_round_down", "0", CVAR_RENDERINFO, "down size non-power of two textures" );
|
||||
image.baseformats = load_xash;
|
||||
image.baseformats = load_hl1;
|
||||
|
||||
// install image formats (can be re-install later by Image_Setup)
|
||||
switch( Sys.app_name )
|
||||
|
@ -1498,6 +1498,8 @@ qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( !flags ) return false; // no operation specfied
|
||||
|
||||
if( flags & IMAGE_MAKE_LUMA )
|
||||
{
|
||||
out = Image_CreateLumaInternal( pic->buffer, pic->width, pic->height, pic->type, pic->flags );
|
||||
|
|
|
@ -404,8 +404,8 @@ void Cmd_Frame( void )
|
|||
pframe->height = h;
|
||||
|
||||
// adjust maxsize
|
||||
if(w > sprite.bounds[0]) sprite.bounds[0] = w;
|
||||
if(h > sprite.bounds[1]) sprite.bounds[1] = h;
|
||||
if( w > sprite.bounds[0] ) sprite.bounds[0] = w;
|
||||
if( h > sprite.bounds[1] ) sprite.bounds[1] = h;
|
||||
|
||||
plump = (byte *)(pframe + 1); // move pointer
|
||||
fin = frame->buffer + yl * frame->width + xl;
|
||||
|
|
|
@ -37,7 +37,7 @@ const char *uiSoundIn = "media/launch_upmenu1.wav";
|
|||
const char *uiSoundOut = "media/launch_dnmenu1.wav";
|
||||
const char *uiSoundLaunch = "media/launch_select2.wav";
|
||||
const char *uiSoundGlow = "media/launch_glow1.wav";
|
||||
const char *uiSoundBuzz = "media/menu1.wav";
|
||||
const char *uiSoundBuzz = "media/launch_deny2.wav";
|
||||
const char *uiSoundKey = "media/launch_select1.wav";
|
||||
const char *uiSoundRemoveKey = "media/launch_deny1.wav";
|
||||
const char *uiSoundMove = ""; // Xash3D not use movesound
|
||||
|
@ -113,7 +113,7 @@ void UI_DrawPic( int x, int y, int width, int height, const int color, const cha
|
|||
UnpackRGBA( r, g, b, a, color );
|
||||
|
||||
PIC_Set( hPic, r, g, b, a );
|
||||
PIC_Draw( 0, x, y, width, height );
|
||||
PIC_Draw( x, y, width, height );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -129,7 +129,7 @@ void UI_DrawPicAdditive( int x, int y, int width, int height, const int color, c
|
|||
UnpackRGBA( r, g, b, a, color );
|
||||
|
||||
PIC_Set( hPic, r, g, b, a );
|
||||
PIC_DrawAdditive( 0, x, y, width, height );
|
||||
PIC_DrawAdditive( x, y, width, height );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -305,7 +305,7 @@ void UI_DrawMouseCursor( void )
|
|||
if( hCursor == -1 ) hCursor = PIC_Load( UI_CURSOR_NORMAL, cursor_tga, sizeof( cursor_tga ));
|
||||
|
||||
PIC_Set( hCursor, 255, 255, 255 );
|
||||
PIC_DrawTrans( 0, uiStatic.cursorX, uiStatic.cursorY, w, h );
|
||||
PIC_DrawTrans( uiStatic.cursorX, uiStatic.cursorY, w, h );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#define FREE( x ) (*g_engfuncs.pfnMemFree)( x, __FILE__, __LINE__ )
|
||||
|
||||
// screen handlers
|
||||
#define PIC_Frames (*g_engfuncs.pfnPIC_Frames)
|
||||
#define PIC_Width (*g_engfuncs.pfnPIC_Width)
|
||||
#define PIC_Height (*g_engfuncs.pfnPIC_Height)
|
||||
#define PIC_EnableScissor (*g_engfuncs.pfnPIC_EnableScissor)
|
||||
|
@ -81,7 +80,6 @@ inline HIMAGE PIC_Load( const char *szPicName, const byte *ucRawImage, long ulRa
|
|||
#define GET_VIDEO_LIST (*g_engfuncs.pfnGetVideoList)
|
||||
#define GET_GAMES_LIST (*g_engfuncs.pfnGetGamesList)
|
||||
#define BACKGROUND_TRACK (*g_engfuncs.pfnPlayBackgroundTrack)
|
||||
#define CHANGE_VIDEO (*g_engfuncs.pfnChangeVideo)
|
||||
#define SHELL_EXECUTE (*g_engfuncs.pfnShellExecute)
|
||||
#define HOST_WRITECONFIG (*g_engfuncs.pfnWriteServerConfig)
|
||||
#define HOST_CHANGEGAME (*g_engfuncs.pfnChangeInstance)
|
||||
|
@ -105,44 +103,44 @@ inline void PIC_Set( HIMAGE hPic, int r, int g, int b, int a )
|
|||
g_engfuncs.pfnPIC_Set( hPic, r, g, b, a );
|
||||
}
|
||||
|
||||
inline void PIC_Draw( int frame, int x, int y, const wrect_t *prc )
|
||||
inline void PIC_Draw( int x, int y, const wrect_t *prc )
|
||||
{
|
||||
g_engfuncs.pfnPIC_Draw( frame, x, y, -1, -1, prc );
|
||||
g_engfuncs.pfnPIC_Draw( x, y, -1, -1, prc );
|
||||
}
|
||||
|
||||
inline void PIC_Draw( int frame, int x, int y, int width, int height )
|
||||
inline void PIC_Draw( int x, int y, int width, int height )
|
||||
{
|
||||
g_engfuncs.pfnPIC_Draw( frame, x, y, width, height, NULL );
|
||||
g_engfuncs.pfnPIC_Draw( x, y, width, height, NULL );
|
||||
}
|
||||
|
||||
inline void PIC_DrawTrans( int frame, int x, int y, const wrect_t *prc )
|
||||
inline void PIC_DrawTrans( int x, int y, const wrect_t *prc )
|
||||
{
|
||||
g_engfuncs.pfnPIC_DrawTrans( frame, x, y, -1, -1, prc );
|
||||
g_engfuncs.pfnPIC_DrawTrans( x, y, -1, -1, prc );
|
||||
}
|
||||
|
||||
inline void PIC_DrawTrans( int frame, int x, int y, int width, int height )
|
||||
inline void PIC_DrawTrans( int x, int y, int width, int height )
|
||||
{
|
||||
g_engfuncs.pfnPIC_DrawTrans( frame, x, y, width, height, NULL );
|
||||
g_engfuncs.pfnPIC_DrawTrans( x, y, width, height, NULL );
|
||||
}
|
||||
|
||||
inline void PIC_DrawHoles( int frame, int x, int y, const wrect_t *prc )
|
||||
inline void PIC_DrawHoles( int x, int y, const wrect_t *prc )
|
||||
{
|
||||
g_engfuncs.pfnPIC_DrawHoles( frame, x, y, -1, -1, prc );
|
||||
g_engfuncs.pfnPIC_DrawHoles( x, y, -1, -1, prc );
|
||||
}
|
||||
|
||||
inline void SPR_DrawHoles( int frame, int x, int y, int width, int height )
|
||||
inline void SPR_DrawHoles( int x, int y, int width, int height )
|
||||
{
|
||||
g_engfuncs.pfnPIC_DrawHoles( frame, x, y, width, height, NULL );
|
||||
g_engfuncs.pfnPIC_DrawHoles( x, y, width, height, NULL );
|
||||
}
|
||||
|
||||
inline void PIC_DrawAdditive( int frame, int x, int y, int width, int height )
|
||||
inline void PIC_DrawAdditive( int x, int y, int width, int height )
|
||||
{
|
||||
g_engfuncs.pfnPIC_DrawAdditive( frame, x, y, width, height, NULL );
|
||||
g_engfuncs.pfnPIC_DrawAdditive( x, y, width, height, NULL );
|
||||
}
|
||||
|
||||
inline void PIC_DrawAdditive( int frame, int x, int y, const wrect_t *prc )
|
||||
inline void PIC_DrawAdditive( int x, int y, const wrect_t *prc )
|
||||
{
|
||||
g_engfuncs.pfnPIC_DrawAdditive( frame, x, y, -1, -1, prc );
|
||||
g_engfuncs.pfnPIC_DrawAdditive( x, y, -1, -1, prc );
|
||||
}
|
||||
|
||||
inline void TextMessageSetColor( int r, int g, int b, int alpha = 255 )
|
||||
|
|
|
@ -129,7 +129,7 @@ static void UI_VidOptions_SetConfig( void )
|
|||
CVAR_SET_FLOAT( "fullscreen", !uiVidModes.windowed.enabled );
|
||||
CVAR_SET_FLOAT( "r_allow_software", uiVidModes.software.enabled );
|
||||
|
||||
CHANGE_VIDEO( uiVidModes.videoList[(int)uiVidModes.videoLibrary.curValue] );
|
||||
CLIENT_COMMAND( TRUE, "vid_restart\n" );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1621,8 +1621,8 @@ void UI_Action_Init( menuAction_s *a )
|
|||
if( a->background )
|
||||
{
|
||||
HIMAGE handle = PIC_Load( a->background );
|
||||
a->generic.width = PIC_Width( handle, 0 );
|
||||
a->generic.height = PIC_Height( handle, 0 );
|
||||
a->generic.width = PIC_Width( handle );
|
||||
a->generic.height = PIC_Height( handle );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Reference in New Issue