Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions source/cgame/cg_hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2350,12 +2350,6 @@ static bool CG_LFuncDrawHelpMessage( struct cg_layoutnode_s *commandnode, struct
return true;
}

static bool CG_LFuncDrawTeamMates( struct cg_layoutnode_s *commandnode, struct cg_layoutnode_s *argumentnode, int numArguments )
{
CG_DrawTeamMates();
return true;
}

static bool CG_LFuncDrawDamageNumbers( struct cg_layoutnode_s *commandnode, struct cg_layoutnode_s *argumentnode, int numArguments ) {
CG_DrawDamageNumbers();
return true;
Expand Down Expand Up @@ -3238,16 +3232,6 @@ static const cg_layoutcommand_t cg_LayoutCommands[] =
"Draws the name of the player in the crosshair",
false
},

{
"drawTeamMates",
CG_LFuncDrawTeamMates,
NULL,
0,
"Draws indicators where team mates are",
false
},

{
"drawDamageNumbers",
CG_LFuncDrawDamageNumbers,
Expand Down
15 changes: 14 additions & 1 deletion source/cgame/cg_pmodels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

pmodel_t cg_entPModels[MAX_EDICTS];
pmodelinfo_t *cg_PModelInfos;
static cvar_t *cg_showTeamMates;

//======================================================================
// PlayerModel Registering
Expand All @@ -42,6 +43,7 @@ pmodelinfo_t *cg_PModelInfos;
*/
void CG_PModelsInit( void )
{
cg_showTeamMates = trap_Cvar_Get( "cg_showTeamMates", "1", CVAR_ARCHIVE );
memset( cg_entPModels, 0, sizeof( cg_entPModels ) );
}

Expand Down Expand Up @@ -1303,9 +1305,20 @@ void CG_AddPModel( centity_t *cent )
if( !( cent->effects & EF_RACEGHOST ) )
{
CG_AddCentityOutLineEffect( cent );

if( cent->current.team == cg.predictedPlayerState.stats[STAT_TEAM] && cg_showTeamMates->integer) {
vec4_t color;
CG_TeamColor( cg.predictedPlayerState.stats[STAT_TEAM], color );
cent->ent.outlineColorGhost[0] = color[0] * 255.0f;
cent->ent.outlineColorGhost[1] = color[1] * 255.0f;
cent->ent.outlineColorGhost[2] = color[2] * 255.0f;
cent->ent.outlineColorGhost[3] = 255;
cent->ent.outlineGhost = 1.5f;
}

CG_AddEntityToScene( &cent->ent );
}

if( !cent->ent.model )
return;

Expand Down
5 changes: 2 additions & 3 deletions source/cgame/cg_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -863,9 +863,8 @@ void CG_DrawPlayerNames( struct qfontface_s *font, vec4_t color )
}
}

/*
* CG_DrawTeamMates
*/
// ref: https://github.com/TeamForbiddenLLC/warfork-qfusion/pull/395
// Note: replaced with player outline
void CG_DrawTeamMates( void )
{
centity_t *cent;
Expand Down
8 changes: 8 additions & 0 deletions source/cgame/ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define RF_GREYSCALE 0x400
#define RF_NODEPTHTEST 0x800
#define RF_NOCOLORWRITE 0x1000
#define RF_OUTLINE_STENCIL_0 0x2000
#define RF_OUTLINE_STENCIL_1 0x4000

// refdef flags
#define RDF_UNDERWATER 0x1 // warp the screen as apropriate
Expand Down Expand Up @@ -161,11 +163,17 @@ typedef struct entity_s
float rotation;

float outlineHeight;
float outlineGhost;
union
{
byte_vec4_t outlineColor;
uint8_t outlineRGBA[4];
};
union
{
byte_vec4_t outlineColorGhost;
uint8_t outlineRGBAGhost[4];
};
} entity_t;

typedef struct refdef_s
Expand Down
1 change: 0 additions & 1 deletion source/qcommon/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ void Com_Printf( const char *format, ... )
Q_vsnprintfz( msg, sizeof( msg ), format, argptr );
va_end( argptr );


QMutex_Lock( com_print_mutex );

if( rd_target )
Expand Down
1 change: 1 addition & 0 deletions source/qcommon/snap_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,7 @@ static bool SNAP_SnapCullEntity( cmodel_state_t *cms, edict_t *ent, edict_t *cle
if( frame->allentities )
return false;


// filters: transmit only to clients in the same team as this entity
// broadcasting is less important than team specifics
if( ( ent->r.svflags & SVF_ONLYTEAM ) && ( clent && ent->s.team != clent->s.team ) )
Expand Down
12 changes: 9 additions & 3 deletions source/ref_gl/r_alias.c
Original file line number Diff line number Diff line change
Expand Up @@ -787,23 +787,29 @@ bool R_AddAliasModelToDrawList( const entity_t *e )
for( i = 0, mesh = aliasmodel->meshes; i < aliasmodel->nummeshes; i++, mesh++ )
{
shader = NULL;

int order = 0;
if( e->customSkin ) {
shader = R_FindShaderForSkinFile( e->customSkin, mesh->name );
} else if( e->customShader ) {
shader = e->customShader;
} else if( mesh->numskins ) {
for( j = 0; j < mesh->numskins; j++ ) {
shader = mesh->skins[j].shader;
if( shader->sort == SHADER_SORT_OPAQUE ) {
order = R_PackOpaqueOrder( e, shader, false, false );
}
if( shader ) {
R_AddSurfToDrawList( rn.meshlist, e, fog, shader, distance, 0, NULL, aliasmodel->drawSurfs + i );
R_AddSurfToDrawList( rn.meshlist, e, fog, shader, distance, order, NULL, aliasmodel->drawSurfs + i );
}
}
continue;
}

if( shader ) {
R_AddSurfToDrawList( rn.meshlist, e, fog, shader, distance, 0, NULL, aliasmodel->drawSurfs + i );
if( shader->sort == SHADER_SORT_OPAQUE ) {
order = R_PackOpaqueOrder( e, shader, false, false );
}
R_AddSurfToDrawList( rn.meshlist, e, fog, shader, distance, order, NULL, aliasmodel->drawSurfs + i );
}
}

Expand Down
45 changes: 40 additions & 5 deletions source/ref_gl/r_backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,52 @@ void RB_StatsMessage( char *msg, size_t size )
);
}

void RB_SetStencilFunc( int func, int ref, int mask )
{
if( !glConfig.stencilBits )
return;
if( rb.gl.stencilFunc == func && rb.gl.stencilRef == ref && rb.gl.stencilFuncMask == mask )
return;

qglStencilFunc( func, ref, mask );
rb.gl.stencilFunc = func;
rb.gl.stencilRef = ref;
rb.gl.stencilFuncMask = mask;
}

void RB_SetStencilOp( int sfail, int dpfail, int dppass )
{
if( !glConfig.stencilBits )
return;
if( rb.gl.stencilSFail == sfail && rb.gl.stencilDPFail == dpfail && rb.gl.stencilDPPass == dppass )
return;

qglStencilOp( sfail, dpfail, dppass );
rb.gl.stencilSFail = sfail;
rb.gl.stencilDPFail = dpfail;
rb.gl.stencilDPPass = dppass;
}

void RB_SetStencilMask( int mask )
{
if( !glConfig.stencilBits )
return;
if( rb.gl.stencilMask == mask )
return;
qglStencilMask( mask );
rb.gl.stencilMask = mask;
}

/*
* RB_SetGLDefaults
*/
static void RB_SetGLDefaults( void )
{
if( glConfig.stencilBits )
{
qglStencilMask( ( GLuint ) ~0 );
qglStencilFunc( GL_EQUAL, 128, 0xFF );
qglStencilOp( GL_KEEP, GL_KEEP, GL_INCR );
RB_SetStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
RB_SetStencilMask(( GLuint ) ~0);
RB_SetStencilFunc(GL_EQUAL, 128, 0xFF ) ;
}

qglDisable( GL_CULL_FACE );
Expand Down Expand Up @@ -335,9 +371,8 @@ void RB_Cull( int cull )
*/
void RB_SetState( int state )
{
int diff;

diff = rb.gl.state ^ state;
const int diff = rb.gl.state ^ state;
if( !diff )
return;

Expand Down
4 changes: 4 additions & 0 deletions source/ref_gl/r_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ void RB_LoadCameraMatrix( const mat4_t m );
void RB_LoadObjectMatrix( const mat4_t m );
void RB_LoadProjectionMatrix( const mat4_t m );

void RB_SetStencilFunc( int func, int ref, int mask );
void RB_SetStencilOp( int sfail, int dpfail, int dppass );
void RB_SetStencilMask( int mask );

void RB_DepthRange( float depthmin, float depthmax );
void RB_GetDepthRange( float* depthmin, float *depthmax );
void RB_DepthOffset( bool enable );
Expand Down
6 changes: 5 additions & 1 deletion source/ref_gl/r_backend_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ typedef struct r_backend_s

bool flushTextures;
int currentTMU;
unsigned currentTextures[MAX_TEXTURE_UNITS];
unsigned currentTextures[MAX_TEXTURE_UNITS];

int stencilFunc, stencilRef, stencilFuncMask;
int stencilSFail, stencilDPFail, stencilDPPass;
int stencilMask;
} gl;

unsigned int time;
Expand Down
Loading