Skip to content

Commit

Permalink
Updated render mainly ..
Browse files Browse the repository at this point in the history
- Added r_bloom (default = 0)
- Updated flares
- Fixed bunch of fog issues
- A couple of overflows and so on..
  • Loading branch information
Nate 'L0 committed Jan 22, 2021
1 parent 39b4ac3 commit 8d5628b
Show file tree
Hide file tree
Showing 26 changed files with 1,450 additions and 624 deletions.
28 changes: 26 additions & 2 deletions src/client/cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,7 @@ void CL_PlayDemo_f( void ) {
Con_Close();

cls.state = CA_CONNECTED;
clientIsConnected = qtrue;
clc.demoplaying = qtrue;

if ( Cvar_VariableValue( "cl_wavefilerecord" ) ) {
Expand Down Expand Up @@ -734,6 +735,7 @@ void CL_MapLoading( void ) {
// if we are already connected to the local host, stay connected
if ( cls.state >= CA_CONNECTED && !Q_stricmp( cls.servername, "localhost" ) ) {
cls.state = CA_CONNECTED; // so the connect screen is drawn
clientIsConnected = qtrue;
memset( cls.updateInfoString, 0, sizeof( cls.updateInfoString ) );
memset( clc.serverMessage, 0, sizeof( clc.serverMessage ) );
memset( &cl.gameState, 0, sizeof( cl.gameState ) );
Expand Down Expand Up @@ -821,22 +823,39 @@ void CL_Disconnect( qboolean showMainMenu ) {
CL_WritePacket();
CL_WritePacket();
CL_WritePacket();
clientIsConnected = qfalse;
}

CL_ClearState();

// wipe the client connection
memset( &clc, 0, sizeof( clc ) );

cls.state = CA_DISCONNECTED;
// L0 - Fix shutdowns ..
if (uivm && cls.state > CA_DISCONNECTED) {
cls.state = CA_DISCONNECTED;
clientIsConnected = qfalse;

// shutdown the UI
CL_ShutdownUI();

// init the UI
CL_InitUI();
}
else {
cls.state = CA_DISCONNECTED;
clientIsConnected = qfalse;
}

// allow cheats locally
Cvar_Set( "sv_cheats", "1" );

// not connected to a pure server anymore
cl_connectedToPureServer = qfalse;
}

// L0 - Set this to off as well
clientIsConnected = qfalse;
}

/*
===================
Expand Down Expand Up @@ -1588,6 +1607,7 @@ void CL_InitDownloads( void ) {
Q_strncpyz( autoupdateFilename, cl_updatefiles->string, sizeof( autoupdateFilename ) );
Q_strncpyz( clc.downloadList, va( "@%s/%s@%s/%s", dir, cl_updatefiles->string, dir, cl_updatefiles->string ), MAX_INFO_STRING );
cls.state = CA_CONNECTED;
clientIsConnected = qtrue;
CL_NextDownload();
return;
}
Expand All @@ -1607,6 +1627,7 @@ void CL_InitDownloads( void ) {
if ( *clc.downloadList ) {
// if autodownloading is not enabled on the server
cls.state = CA_CONNECTED;
clientIsConnected = qtrue;
CL_NextDownload();
return;
}
Expand Down Expand Up @@ -2006,6 +2027,7 @@ void CL_ConnectionlessPacket( netadr_t from, msg_t *msg ) {
Netchan_Setup( NS_CLIENT, &clc.netchan, from, Cvar_VariableValue( "net_qport" ) );
cls.state = CA_CONNECTED;
clc.lastPacketSentTime = -9999; // send first packet immediately
clientIsConnected = qfalse;
return;
}

Expand Down Expand Up @@ -2199,6 +2221,7 @@ void CL_Frame( int msec ) {
// if disconnected, bring up the menu
S_StopAllSounds();
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_MAIN );
clientIsConnected = qfalse;
}

// if recording an avi, lock to a fixed fps
Expand Down Expand Up @@ -2604,6 +2627,7 @@ void CL_GetAutoUpdate( void ) {
if ( cls.autoupdateServer.type == NA_BAD ) {
Com_Printf( "Bad server address\n" );
cls.state = CA_DISCONNECTED;
clientIsConnected = qfalse;
return;
}

Expand Down
1 change: 1 addition & 0 deletions src/client/cl_scrn.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ void SCR_DrawScreenField( stereoFrame_t stereoFrame ) {
case CA_CONNECTING:
case CA_CHALLENGING:
case CA_CONNECTED:
clientIsConnected = qtrue; // L0 - Set this on..
// connecting clients will only show the connection dialog
// refresh to update the time
VM_Call( uivm, UI_REFRESH, cls.realtime );
Expand Down
1 change: 0 additions & 1 deletion src/game/game.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ copy $(SolutionDir)Builds\$(Configuration)\$(ProjectName)\$(TargetName)$(TargetE
<ClCompile Include="g_tramcar.c" />
<ClCompile Include="g_trigger.c" />
<ClCompile Include="g_utils.c" />
<ClCompile Include="g_vehicles.c" />
<ClCompile Include="g_vote.c" />
<ClCompile Include="g_weapon.c" />
<ClCompile Include="q_math.c" />
Expand Down
3 changes: 0 additions & 3 deletions src/game/game.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,6 @@
<ClCompile Include="g_utils.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="g_vehicles.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="g_vote.c">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down
18 changes: 11 additions & 7 deletions src/game/q_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -962,19 +962,18 @@ COLLISION DETECTION

// plane types are used to speed some tests
// 0-2 are axial planes
#define PLANE_X 0
#define PLANE_Y 1
#define PLANE_Z 2
#define PLANE_NON_AXIAL 3

#define PLANE_X 0
#define PLANE_Y 1
#define PLANE_Z 2
#define PLANE_NON_AXIAL 3
#define PLANE_NON_PLANAR 4

/*
=================
PlaneTypeForNormal
=================
*/

#define PlaneTypeForNormal( x ) ( x[0] == 1.0 ? PLANE_X : ( x[1] == 1.0 ? PLANE_Y : ( x[2] == 1.0 ? PLANE_Z : PLANE_NON_AXIAL ) ) )
#define PlaneTypeForNormal( x ) ( x[0] == 1.0 ? PLANE_X : ( x[1] == 1.0 ? PLANE_Y : ( x[2] == 1.0 ? PLANE_Z : ( x[0] == 0.f && x[1] == 0.f && x[2] == 0.f ? PLANE_NON_PLANAR : PLANE_NON_AXIAL ) ) ) )

// plane_t structure
// !!! if this is changed, it must be changed in asm code too !!!
Expand Down Expand Up @@ -1539,6 +1538,11 @@ typedef enum {
CA_CINEMATIC // playing a cinematic or a static pic, not connected to a server
} connstate_t;

// L0
// Indicates if client is connected or not.
// Deals with Bloom issues as well as just identifying if extra stuff should be ran..
qboolean clientIsConnected;

// font support

#define GLYPH_START 0
Expand Down
5 changes: 4 additions & 1 deletion src/qcommon/qfiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -692,12 +692,15 @@ typedef struct {
byte color[4];
} drawVert_t;

#define drawVert_t_cleared(x) drawVert_t (x) = {{0, 0, 0}, {0, 0}, {0, 0}, {0, 0, 0}, {0, 0, 0, 0}}

typedef enum {
MST_BAD,
MST_PLANAR,
MST_PATCH,
MST_TRIANGLE_SOUP,
MST_FLARE
MST_FLARE,
MST_FOLIAGE // L0 - TODO: add support for foliage surfaces
} mapSurfaceType_t;

typedef struct {
Expand Down
1 change: 1 addition & 0 deletions src/renderer/renderer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
</ClCompile>
<ClCompile Include="tr_bloom.c" />
<ClCompile Include="tr_bsp.c">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
Expand Down
3 changes: 3 additions & 0 deletions src/renderer/renderer.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@
<ClCompile Include="..\win32\win_qgl.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="tr_bloom.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="anorms256.h">
Expand Down
13 changes: 13 additions & 0 deletions src/renderer/tr_backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,10 @@ void RB_BeginDrawingView( void ) {

qglClearColor( glfogsettings[FOG_CURRENT].color[0], glfogsettings[FOG_CURRENT].color[1], glfogsettings[FOG_CURRENT].color[2], glfogsettings[FOG_CURRENT].color[3] );
}
else if (!(r_portalsky->integer)) { // ydnar: portal skies have been manually turned off, clear bg color
clearBits |= GL_COLOR_BUFFER_BIT;
qglClearColor(0.5, 0.5, 0.5, 1.0);
}
}
} else { // world scene with no portal sky
clearBits |= GL_DEPTH_BUFFER_BIT;
Expand Down Expand Up @@ -513,6 +517,10 @@ void RB_BeginDrawingView( void ) {
}
}

// ydnar: don't clear the color buffer when no world model is specified
if (backEnd.refdef.rdflags & RDF_NOWORLDMODEL) {
clearBits &= ~GL_COLOR_BUFFER_BIT;
}

if ( clearBits ) {
qglClear( clearBits );
Expand Down Expand Up @@ -1140,6 +1148,7 @@ const void *RB_DrawSurfs( const void *data ) {

backEnd.refdef = cmd->refdef;
backEnd.viewParms = cmd->viewParms;
backEnd.doneSurfaces = qtrue;

RB_RenderDrawSurfList( cmd->drawSurfs, cmd->numDrawSurfs );

Expand Down Expand Up @@ -1281,6 +1290,8 @@ const void *RB_SwapBuffers( const void *data ) {
GLimp_EndFrame();

backEnd.projection2D = qfalse;
backEnd.doneBloom = qfalse;
backEnd.doneSurfaces = qfalse;

return (const void *)( cmd + 1 );
}
Expand Down Expand Up @@ -1310,6 +1321,7 @@ void RB_ExecuteRenderCommands( const void *data ) {
data = RB_SetColor( data );
break;
case RC_STRETCH_PIC:
R_BloomScreen();
data = RB_StretchPic( data );
break;
case RC_ROTATED_PIC:
Expand All @@ -1325,6 +1337,7 @@ void RB_ExecuteRenderCommands( const void *data ) {
data = RB_DrawBuffer( data );
break;
case RC_SWAP_BUFFERS:
R_BloomScreen();
data = RB_SwapBuffers( data );
break;

Expand Down
Loading

0 comments on commit 8d5628b

Please sign in to comment.