Skip to content

Commit

Permalink
v6.0 addings, debug/release options minor bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
RezWaki committed Apr 27, 2020
1 parent ca15cd8 commit a96a49d
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 26 deletions.
91 changes: 72 additions & 19 deletions cl_dll/StudioModelRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
#include "renderfuncs.h"
#include "pmtrace.h"
#include "studio_util.h"
//#include <Windows.h>
#include <GL\GL.h>
#include <GL\GLU.h>

#pragma comment( lib, "opengl32.lib" )

// Global engine <-> studio model rendering code interface
engine_studio_api_t IEngineStudio;
Expand Down Expand Up @@ -1041,6 +1046,8 @@ void CStudioModelRenderer::StudioMergeBones ( model_t *m_pSubModel )
}
}

INT pWeapBoxColors[3], iPhase = 0;

/*
====================
StudioDrawModel
Expand Down Expand Up @@ -1151,6 +1158,8 @@ int CStudioModelRenderer::StudioDrawModel( int flags )
lighting.ambientlight = 255;
}

//gEngfuncs.pfnCenterPrint( m_pRenderModel->name );

// model and frame independant
IEngineStudio.StudioSetupLighting (&lighting);

Expand Down Expand Up @@ -1477,6 +1486,31 @@ int CStudioModelRenderer::StudioDrawPlayer( int flags, entity_state_t *pplayer )
lighting.ambientlight = 255;
}

if( CVAR_GET_FLOAT("cl_flashplayer") ) {
iPhase++;
if( iPhase <= 500 ) {
pWeapBoxColors[0] = pWeapBoxColors[1] = pWeapBoxColors[2] = 255;
}
else if( iPhase > 500 && iPhase <= 1000 ) {
pWeapBoxColors[0] = 255;
pWeapBoxColors[1] = pWeapBoxColors[2] = 0;
}
else if( iPhase > 1000 ) iPhase = 0;
lighting.color = Vector( pWeapBoxColors[0], pWeapBoxColors[1], pWeapBoxColors[2] );
}

if( CVAR_GET_FLOAT("cl_specwh") && gEngfuncs.GetLocalPlayer()->curstate.spectator ) {
if( CVAR_GET_FLOAT("cl_flashplayer") ) gEngfuncs.Cvar_SetValue( "cl_flashplayer", 0.0 );
if( CVAR_GET_FLOAT("r_forcerendercolors") != 0 ) gEngfuncs.Cvar_SetValue( "r_forcerendercolors", 0 );
pTracePlayer = gEngfuncs.PM_TraceLine( gEngfuncs.GetLocalPlayer()->origin, m_pCurrentEntity->origin, 1, 2, -1 );
if( pTracePlayer->fraction == 1.0 ) {
lighting.color = Vector( 0, 255, 0 ); //visible = green
}
else{
lighting.color = Vector( 255, 0, 0 ); //invisible = red
}
}

// model and frame independant
IEngineStudio.StudioSetupLighting (&lighting);

Expand Down Expand Up @@ -1566,6 +1600,8 @@ void CStudioModelRenderer::StudioCalcAttachments( void )
}
}

int modelZpos = 0, iStep = 0, iTurn = 0;

/*
====================
StudioRenderModel
Expand All @@ -1574,28 +1610,32 @@ StudioRenderModel
*/
void CStudioModelRenderer::StudioRenderModel( void )
{
IEngineStudio.SetChromeOrigin();
IEngineStudio.SetForceFaceFlags( 0 );
if( !CVAR_GET_FLOAT("r_extrachrome") ) {
IEngineStudio.SetChromeOrigin();
IEngineStudio.SetForceFaceFlags( 0 );

if ( m_pCurrentEntity->curstate.renderfx == kRenderFxGlowShell )
{
m_pCurrentEntity->curstate.renderfx = kRenderFxNone;
StudioRenderFinal( );

if ( !IEngineStudio.IsHardware() )
if ( m_pCurrentEntity->curstate.renderfx == kRenderFxGlowShell )
{
gEngfuncs.pTriAPI->RenderMode( kRenderTransAdd );
}

IEngineStudio.SetForceFaceFlags( STUDIO_NF_CHROME );

gEngfuncs.pTriAPI->SpriteTexture( m_pChromeSprite, 0 );
m_pCurrentEntity->curstate.renderfx = kRenderFxGlowShell;
m_pCurrentEntity->curstate.renderfx = kRenderFxNone;
StudioRenderFinal( );

if ( !IEngineStudio.IsHardware() )
{
gEngfuncs.pTriAPI->RenderMode( kRenderTransAdd );
}
IEngineStudio.SetForceFaceFlags( STUDIO_NF_CHROME );
gEngfuncs.pTriAPI->SpriteTexture( m_pChromeSprite, 0 );
m_pCurrentEntity->curstate.renderfx = kRenderFxGlowShell;

StudioRenderFinal( );
if ( !IEngineStudio.IsHardware() )
StudioRenderFinal( );
if ( !IEngineStudio.IsHardware() )
{
gEngfuncs.pTriAPI->RenderMode( kRenderNormal );
}
}
else
{
gEngfuncs.pTriAPI->RenderMode( kRenderNormal );
StudioRenderFinal( );
}
}
else
Expand Down Expand Up @@ -1649,6 +1689,9 @@ void CStudioModelRenderer::StudioRenderFinal_Software( void )
IEngineStudio.RestoreRenderer();
}

color24 pWeapRenderColors;
INT iPlus = 1;

/*
====================
StudioRenderFinal_Hardware
Expand Down Expand Up @@ -1685,7 +1728,7 @@ void CStudioModelRenderer::StudioRenderFinal_Hardware( void )

IEngineStudio.GL_SetRenderMode( rendermode );
IEngineStudio.StudioDrawPoints();
IEngineStudio.GL_StudioDrawShadow();
//IEngineStudio.GL_StudioDrawShadow();
}
}

Expand All @@ -1696,6 +1739,16 @@ void CStudioModelRenderer::StudioRenderFinal_Hardware( void )
gEngfuncs.pTriAPI->RenderMode( kRenderNormal );
}

if( CVAR_GET_FLOAT("cl_specwh") && gEngfuncs.GetLocalPlayer()->curstate.spectator ) {
glDepthRange( 0.0, 0.5 );
}
if( CVAR_GET_FLOAT("r_extrachrome") == 2 ) {
gEngfuncs.GetViewModel()->curstate.renderfx = kRenderFxGlowShell;
}
else{
gEngfuncs.GetViewModel()->curstate.renderfx = kRenderFxNone;
}

IEngineStudio.RestoreRenderer();
}

Expand Down
6 changes: 5 additions & 1 deletion cl_dll/hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,17 @@ void CHud :: Init( void )
CVAR_CREATE( "cl_gaussbeam_color", "150 0 255", NULL );
CVAR_CREATE( "r_fakedrawentities", "1", NULL );
CVAR_CREATE( "cl_hudweapon", "0", NULL );
CVAR_CREATE( "cl_smart_crosshair", "0", NULL );
CVAR_CREATE( "cl_smart_crosshair", "1", NULL );
CVAR_CREATE( "r_noplayerlights", "0", NULL );
CVAR_CREATE( "r_noitemlights", "0", NULL );
CVAR_CREATE( "r_forcerendercolors", "0", NULL );
CVAR_CREATE( "cl_newhud", "1", NULL );
CVAR_CREATE( "cl_usenewteamcolors", "1", NULL );
CVAR_CREATE( "cl_hltvmode", "0", NULL );
CVAR_CREATE( "r_extrachrome", "1", NULL );
CVAR_CREATE( "cl_flashplayer", "0", NULL );
CVAR_CREATE( "cl_specwh", "0", NULL );
CVAR_CREATE( "cl_viewmodelmode", "0", NULL );

m_pSpriteList = NULL;

Expand Down
4 changes: 2 additions & 2 deletions cl_dll/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1032,8 +1032,8 @@ void InitInput (void)
cl_pitchup = gEngfuncs.pfnRegisterVariable ( "cl_pitchup", "89", 0 );
cl_pitchdown = gEngfuncs.pfnRegisterVariable ( "cl_pitchdown", "89", 0 );
CVAR_CREATE( "cl_autobhop", "0", NULL );
CVAR_CREATE( "cl_slide", "1", NULL );
CVAR_CREATE( "cl_slidefactor", "0.9", NULL );
CVAR_CREATE( "cl_slide", "2", NULL );
CVAR_CREATE( "cl_slidefactor", "0.2", NULL );

cl_vsmoothing = gEngfuncs.pfnRegisterVariable ( "cl_vsmoothing", "0.05", FCVAR_ARCHIVE );

Expand Down
8 changes: 4 additions & 4 deletions cl_dll/renderfuncs.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#include "GameStudioModelRenderer.h"
#include <Windows.h>
#include <vector>
#ifndef _DEBUG
//#ifndef _DEBUG
#include <GL\glew.h>
#endif
//#endif

/*
#include "hud.h"
Expand All @@ -41,9 +41,9 @@
#include "GameStudioModelRenderer.h"
*/

#define CL_VER "5.0"
#define CL_VER "6.0"

#ifdef _DEBUG
#ifndef _DEBUG
#pragma comment( lib, "opengl32.lib" )
#pragma comment( lib, "glew32.lib" )
#endif //glew?? dont need if its release
Expand Down
4 changes: 4 additions & 0 deletions cl_dll/tri.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ Non-transparent triangles-- add them here
void DLLEXPORT HUD_DrawNormalTriangles( void )
{
gHUD.m_Spectator.DrawOverview();
/*model_s* pMap = IEngineStudio.GetModelByIndex(1);
IEngineStudio.SetRenderModel( pMap );
IEngineStudio.SetForceFaceFlags( STUDIO_NF_FULLBRIGHT );
IEngineStudio.SetRenderModel( pMap );*/
if( CVAR_GET_FLOAT("r_glwireframe") == 1 ) {
gpRenderFuncs.WireframeForModel( IEngineStudio.GetModelByIndex(1) );
}
Expand Down

0 comments on commit a96a49d

Please sign in to comment.