diff --git a/common/lightstyle.h b/common/lightstyle.h index 943c53d6..af4add8b 100644 --- a/common/lightstyle.h +++ b/common/lightstyle.h @@ -23,6 +23,7 @@ typedef struct int length; float value; qboolean interp; // allow to interpolate this lightstyle + float time; // local time is gurantee what new style begins from the start, not mid or end of the sequence } lightstyle_t; #endif//LIGHTSTYLE_H \ No newline at end of file diff --git a/common/ref_params.h b/common/ref_params.h index 838cb943..a544925c 100644 --- a/common/ref_params.h +++ b/common/ref_params.h @@ -72,4 +72,19 @@ typedef struct ref_params_s float fov_x, fov_y; // actual fov can be overrided on nextView } ref_params_t; +// same as ref_params but for overview mode +typedef struct ref_overview_s +{ + vec3_t origin; + qboolean rotated; + + float xLeft; + float xRight; + float xTop; + float xBottom; + float zFar; + float zNear; + float flZoom; +} ref_overview_t; + #endif//REF_PARAMS_H \ No newline at end of file diff --git a/common/render_api.h b/common/render_api.h index 802de9a0..703e7927 100644 --- a/common/render_api.h +++ b/common/render_api.h @@ -174,6 +174,7 @@ typedef struct render_api_s void (*R_StoreEfragsExt)( struct efrag_s **ppefrag, int framecount ); // store efrags for static entities void (*GL_TextureTarget)( unsigned int target ); // change texture unit mode without bind texture struct mstudiotex_s *( *StudioGetTexture )( struct cl_entity_s *e ); // moved here to avoid incompatibility with IEngineStudio official iface + const struct ref_overview_s *( *GetOverviewParms )( void ); } render_api_t; // render callbacks diff --git a/dlls/apache.cpp b/dlls/apache.cpp index 2b8d4edd..a28d5655 100644 --- a/dlls/apache.cpp +++ b/dlls/apache.cpp @@ -35,7 +35,7 @@ class CApache : public CBaseMonster void Spawn( void ); void Precache( void ); - int Classify( void ) { return CLASS_HUMAN_MILITARY; }; + int Classify( void ) { return m_iClass ? m_iClass : CLASS_HUMAN_MILITARY; }; int BloodColor( void ) { return DONT_BLEED; } void Killed( entvars_t *pevAttacker, int iGib ); void GibMonster( void ); diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index a5cf4943..5e952476 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -764,11 +764,13 @@ void CL_ParseLightStyle( sizebuf_t *msg ) { int style; const char *s; + float f; style = BF_ReadByte( msg ); s = BF_ReadString( msg ); + f = BF_ReadFloat( msg ); - CL_SetLightstyle( style, s ); + CL_SetLightstyle( style, s, f ); } /* diff --git a/engine/client/cl_tent.c b/engine/client/cl_tent.c index 7d65f7a5..66779678 100644 --- a/engine/client/cl_tent.c +++ b/engine/client/cl_tent.c @@ -2295,7 +2295,7 @@ void CL_ClearLightStyles( void ) Q_memset( cl.lightstyles, 0, sizeof( cl.lightstyles )); } -void CL_SetLightstyle( int style, const char *s ) +void CL_SetLightstyle( int style, const char *s, float f ) { int i, k; lightstyle_t *ls; @@ -2309,15 +2309,16 @@ void CL_SetLightstyle( int style, const char *s ) Q_strncpy( ls->pattern, s, sizeof( ls->pattern )); ls->length = Q_strlen( s ); + ls->time = f; // set local time for( i = 0; i < ls->length; i++ ) ls->map[i] = (float)(s[i] - 'a'); - ls->interp = true; + ls->interp = (ls->length <= 1) ? false : true; // check for allow interpolate // NOTE: fast flickering styles looks ugly when interpolation is running - for( k = 0; k < ls->length; k++ ) + for( k = 0; k < (ls->length - 1); k++ ) { val1 = ls->map[(k+0) % ls->length]; val2 = ls->map[(k+1) % ls->length]; diff --git a/engine/client/client.h b/engine/client/client.h index 0ff02977..d82499dc 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -283,21 +283,6 @@ typedef struct model_t *model; // for catch model changes } remap_info_t; -// same as ref_params but for overview mode -typedef struct -{ - vec3_t origin; - qboolean rotated; - - float xLeft; - float xRight; - float xTop; - float xBottom; - float zFar; - float zNear; - float flZoom; -} ref_overview_t; - typedef struct { net_response_t resp; @@ -556,7 +541,7 @@ extern convar_t *hltv; //============================================================================= -void CL_SetLightstyle( int style, const char* s ); +void CL_SetLightstyle( int style, const char* s, float f ); void CL_RunLightStyles( void ); void CL_AddEntities( void ); diff --git a/engine/client/gl_beams.c b/engine/client/gl_beams.c index c6ab9ecd..a920b759 100644 --- a/engine/client/gl_beams.c +++ b/engine/client/gl_beams.c @@ -1568,10 +1568,10 @@ void CL_DrawBeams( int fTrans ) { RI.currentbeam = cl_custombeams[i]; - if( fTrans && RI.currentbeam->curstate.renderfx & FBEAM_SOLID ) + if( fTrans && ((RI.currentbeam->curstate.rendermode & 0xF0) & FBEAM_SOLID )) continue; - if( !fTrans && !( RI.currentbeam->curstate.renderfx & FBEAM_SOLID )) + if( !fTrans && !((RI.currentbeam->curstate.rendermode & 0xF0) & FBEAM_SOLID )) continue; CL_DrawCustomBeam( RI.currentbeam ); diff --git a/engine/client/gl_rlight.c b/engine/client/gl_rlight.c index 0e81e58c..6a24990e 100644 --- a/engine/client/gl_rlight.c +++ b/engine/client/gl_rlight.c @@ -47,11 +47,6 @@ void R_AnimateLight( void ) // light animations // 'm' is normal light, 'a' is no light, 'z' is double bright - flight = (int)floor( cl.time * 10 ); - clight = (int)ceil( cl.time * 10 ); - lerpfrac = ( cl.time * 10 ) - flight; - backlerp = 1.0f - lerpfrac; - for( i = 0, ls = cl.lightstyles; i < MAX_LIGHTSTYLES; i++, ls++ ) { if( r_fullbright->integer || !cl.worldmodel->lightdata ) @@ -61,6 +56,14 @@ void R_AnimateLight( void ) continue; } + if( !RI.refdef.paused && RI.refdef.frametime <= 0.1f ) + ls->time += RI.refdef.frametime; // evaluate local time + + flight = (int)floor( ls->time * 10 ); + clight = (int)ceil( ls->time * 10 ); + lerpfrac = ( ls->time * 10 ) - flight; + backlerp = 1.0f - lerpfrac; + if( !ls->length ) { RI.lightstylevalue[i] = 256 * scale; diff --git a/engine/client/gl_rmain.c b/engine/client/gl_rmain.c index 7aa0a286..e9afafb6 100644 --- a/engine/client/gl_rmain.c +++ b/engine/client/gl_rmain.c @@ -1296,7 +1296,7 @@ void R_RenderFrame( const ref_params_t *fd, qboolean drawWorld ) RI.clipFlags = 15; RI.drawWorld = drawWorld; RI.thirdPerson = cl.thirdperson; - RI.drawOrtho = gl_overview->integer; + RI.drawOrtho = (RI.drawWorld) ? gl_overview->integer : 0; GL_BackendStartFrame(); @@ -1569,6 +1569,11 @@ static void GL_StoreEfrags( efrag_t **ppefrag ) R_StoreEfrags( ppefrag, tr.framecount ); } +static const ref_overview_t *GL_GetOverviewParms( void ) +{ + return &clgame.overView; +} + static render_api_t gRenderAPI = { GL_RenderGetParm, @@ -1614,6 +1619,7 @@ static render_api_t gRenderAPI = R_StoreEfrags, GL_TextureTarget, R_StudioGetTexture, // moved here to avoid incompatibility with official expanded interface of IEngineStduio (HLSDK Update at 30.08.2013) + GL_GetOverviewParms, }; /* diff --git a/engine/common/build.c b/engine/common/build.c index 81a22118..e3740ba1 100644 --- a/engine/common/build.c +++ b/engine/common/build.c @@ -48,6 +48,6 @@ int Q_buildnum( void ) return b; #else - return 2402; + return 2411; #endif } \ No newline at end of file diff --git a/engine/common/protocol.h b/engine/common/protocol.h index 2d8b98bd..2e743022 100644 --- a/engine/common/protocol.h +++ b/engine/common/protocol.h @@ -16,7 +16,7 @@ GNU General Public License for more details. #ifndef PROTOCOL_H #define PROTOCOL_H -#define PROTOCOL_VERSION 47 +#define PROTOCOL_VERSION 48 // server to client #define svc_bad 0 // immediately crash client when received @@ -31,7 +31,7 @@ GNU General Public License for more details. #define svc_stufftext 9 // [string] stuffed into client's console buffer #define svc_setangle 10 // [angle angle angle] set the view angle to this absolute value #define svc_serverdata 11 // [long] protocol ... -#define svc_lightstyle 12 // [index][pattern] +#define svc_lightstyle 12 // [index][pattern][float] #define svc_updateuserinfo 13 // [byte] playernum, [string] userinfo #define svc_deltatable 14 // [table header][...] #define svc_clientdata 15 // [...] diff --git a/engine/server/server.h b/engine/server/server.h index 661dd9be..99e18c6a 100644 --- a/engine/server/server.h +++ b/engine/server/server.h @@ -626,7 +626,7 @@ void SV_TouchLinks( edict_t *ent, areanode_t *node ); int SV_TruePointContents( const vec3_t p ); int SV_PointContents( const vec3_t p ); void SV_RunLightStyles( void ); -void SV_SetLightStyle( int style, const char* s ); +void SV_SetLightStyle( int style, const char* s, float f ); const char *SV_GetLightStyle( int style ); int SV_LightForEntity( edict_t *pEdict ); void SV_ClearPhysEnts( void ); diff --git a/engine/server/sv_client.c b/engine/server/sv_client.c index 00424970..a2ea8d43 100644 --- a/engine/server/sv_client.c +++ b/engine/server/sv_client.c @@ -1438,6 +1438,7 @@ void SV_WriteLightstyles_f( sv_client_t *cl ) BF_WriteByte( &cl->netchan.message, svc_lightstyle ); BF_WriteByte( &cl->netchan.message, start ); BF_WriteString( &cl->netchan.message, sv.lightstyles[start].pattern ); + BF_WriteFloat( &cl->netchan.message, sv.lightstyles[start].time ); } start++; } diff --git a/engine/server/sv_game.c b/engine/server/sv_game.c index 6b636852..94e12949 100644 --- a/engine/server/sv_game.c +++ b/engine/server/sv_game.c @@ -2359,7 +2359,7 @@ void pfnLightStyle( int style, const char* val ) if( style >= MAX_LIGHTSTYLES ) Host_Error( "SV_LightStyle: style: %i >= %d", style, MAX_LIGHTSTYLES ); - SV_SetLightStyle( style, val ); // set correct style + SV_SetLightStyle( style, val, 0.0f ); // set correct style } /* diff --git a/engine/server/sv_save.c b/engine/server/sv_save.c index 43939be1..2c7e2dd1 100644 --- a/engine/server/sv_save.c +++ b/engine/server/sv_save.c @@ -98,7 +98,8 @@ typedef struct typedef struct { int index; - char style[64]; + char style[256]; + float time; } SAVE_LIGHTSTYLE; static TYPEDESCRIPTION gGameHeader[] = @@ -144,7 +145,8 @@ static TYPEDESCRIPTION gAdjacency[] = static TYPEDESCRIPTION gLightStyle[] = { DEFINE_FIELD( SAVE_LIGHTSTYLE, index, FIELD_INTEGER ), - DEFINE_ARRAY( SAVE_LIGHTSTYLE, style, FIELD_CHARACTER, 64 ), + DEFINE_ARRAY( SAVE_LIGHTSTYLE, style, FIELD_CHARACTER, 256 ), + DEFINE_FIELD( SAVE_LIGHTSTYLE, time, FIELD_FLOAT ), }; static TYPEDESCRIPTION gEntityTable[] = @@ -845,6 +847,7 @@ void SV_SaveGameStateGlobals( SAVERESTOREDATA *pSaveData ) if( sv.lightstyles[i].pattern[0] ) { light.index = i; + light.time = sv.lightstyles[i].time; Q_strncpy( light.style, sv.lightstyles[i].pattern, sizeof( light.style )); svgame.dllFuncs.pfnSaveWriteFields( pSaveData, "LIGHTSTYLE", &light, gLightStyle, ARRAYSIZE( gLightStyle )); } @@ -974,7 +977,7 @@ void SV_ParseSaveTables( SAVERESTOREDATA *pSaveData, SAVE_HEADER *pHeader, int s for( i = 0; i < pHeader->lightStyleCount; i++ ) { svgame.dllFuncs.pfnSaveReadFields( pSaveData, "LIGHTSTYLE", &light, gLightStyle, ARRAYSIZE( gLightStyle )); - if( setupLightstyles ) SV_SetLightStyle( light.index, light.style ); + if( setupLightstyles ) SV_SetLightStyle( light.index, light.style, light.time ); } } diff --git a/engine/server/sv_world.c b/engine/server/sv_world.c index d352aa68..c15c626d 100644 --- a/engine/server/sv_world.c +++ b/engine/server/sv_world.c @@ -31,8 +31,6 @@ typedef struct moveclip_s int flags; // trace flags } moveclip_t; -static int sv_lastofs; // lightstyles code use this - /* =============================================================================== @@ -414,8 +412,10 @@ void SV_ClearWorld( void ) // clear lightstyles for( i = 0; i < MAX_LIGHTSTYLES; i++ ) + { sv.lightstyles[i].value = 256.0f; - sv_lastofs = -1; + sv.lightstyles[i].time = 0.0f; + } Q_memset( sv_areanodes, 0, sizeof( sv_areanodes )); sv_numareanodes = 0; @@ -1537,13 +1537,11 @@ void SV_RunLightStyles( void ) lightstyle_t *ls; // run lightstyles animation - ofs = (sv.time * 10); - - if( ofs == sv_lastofs ) return; - sv_lastofs = ofs; - for( i = 0, ls = sv.lightstyles; i < MAX_LIGHTSTYLES; i++, ls++ ) { + ls->time += host.frametime; + ofs = (ls->time * 10); + if( ls->length == 0 ) ls->value = 256.0f * sv_lighting_modulate->value; // disable this light else if( ls->length == 1 ) ls->value = ls->map[0] * 22.0f * sv_lighting_modulate->value; else ls->value = ls->map[ofs%ls->length] * 22.0f * sv_lighting_modulate->value; @@ -1557,11 +1555,12 @@ SV_SetLightStyle needs to get correct working SV_LightPoint ================== */ -void SV_SetLightStyle( int style, const char* s ) +void SV_SetLightStyle( int style, const char* s, float f ) { int j, k; Q_strncpy( sv.lightstyles[style].pattern, s, sizeof( sv.lightstyles[0].pattern )); + sv.lightstyles[style].time = f; j = Q_strlen( s ); sv.lightstyles[style].length = j; @@ -1575,6 +1574,7 @@ void SV_SetLightStyle( int style, const char* s ) BF_WriteByte( &sv.reliable_datagram, svc_lightstyle ); BF_WriteByte( &sv.reliable_datagram, style ); BF_WriteString( &sv.reliable_datagram, sv.lightstyles[style].pattern ); + BF_WriteFloat( &sv.reliable_datagram, sv.lightstyles[style].time ); } /*