From 563304d87a9dddf155b794abebee43b9881d3e9b Mon Sep 17 00:00:00 2001 From: g-cont Date: Sun, 20 Oct 2013 00:00:00 +0400 Subject: [PATCH] 20 Oct 2013 --- engine/client/cl_frame.c | 5 ---- engine/client/cl_main.c | 1 + engine/client/cl_scrn.c | 1 - engine/client/gl_image.c | 21 ++++++++++---- engine/client/gl_studio.c | 49 +++++--------------------------- engine/common/console.c | 1 + engine/common/imagelib/img_bmp.c | 4 +-- engine/server/sv_init.c | 5 ++++ 8 files changed, 32 insertions(+), 55 deletions(-) diff --git a/engine/client/cl_frame.c b/engine/client/cl_frame.c index 09904346..850c7817 100644 --- a/engine/client/cl_frame.c +++ b/engine/client/cl_frame.c @@ -367,7 +367,6 @@ void CL_WeaponAnim( int iAnim, int body ) // save animtime view->latched.prevanimtime = view->curstate.animtime; - view->syncbase = -0.01f; // back up to get 0'th frame animations view->latched.sequencetime = 0.0f; } @@ -429,12 +428,8 @@ void CL_UpdateStudioVars( cl_entity_t *ent, entity_state_t *newstate, qboolean n for( i = 0; i < 2; i++ ) ent->latched.prevseqblending[i] = ent->curstate.blending[i]; ent->latched.prevsequence = ent->curstate.sequence; // save old sequence - ent->syncbase = -0.01f; // back up to get 0'th frame animations } - if( !ent->curstate.frame ) - ent->syncbase = -0.01f; // back up to get 0'th frame animations - if( newstate->animtime != ent->curstate.animtime ) { // client got new packet, shuffle animtimes diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index a7b2f033..d2b08115 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -1812,6 +1812,7 @@ void CL_Shutdown( void ) SCR_Shutdown (); CL_UnloadProgs (); + SCR_FreeCinematic (); // release AVI's *after* client.dll because custom renderer may use them S_Shutdown (); R_Shutdown (); } \ No newline at end of file diff --git a/engine/client/cl_scrn.c b/engine/client/cl_scrn.c index bf9dc670..43f32b01 100644 --- a/engine/client/cl_scrn.c +++ b/engine/client/cl_scrn.c @@ -635,7 +635,6 @@ void SCR_Shutdown( void ) Cmd_RemoveCommand( "skyname" ); Cmd_RemoveCommand( "viewpos" ); UI_SetActiveMenu( false ); - SCR_FreeCinematic(); if( host.state != HOST_RESTART ) UI_UnloadProgs(); diff --git a/engine/client/gl_image.c b/engine/client/gl_image.c index 725f5dd6..80bccdf4 100644 --- a/engine/client/gl_image.c +++ b/engine/client/gl_image.c @@ -143,10 +143,18 @@ void GL_TexFilter( gltexture_t *tex, qboolean update ) { pglTexParameteri( tex->target, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); pglTexParameteri( tex->target, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - pglTexParameteri( tex->target, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB ); pglTexParameteri( tex->target, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL ); - pglTexParameteri( tex->target, GL_DEPTH_TEXTURE_MODE_ARB, GL_INTENSITY ); - + + if( tex->flags & TF_LUMINANCE ) + { + pglTexParameteri( tex->target, GL_DEPTH_TEXTURE_MODE_ARB, GL_LUMINANCE ); + } + else + { + pglTexParameteri( tex->target, GL_DEPTH_TEXTURE_MODE_ARB, GL_INTENSITY ); + pglTexParameteri( tex->target, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB ); + } + if( GL_Support( GL_ANISOTROPY_EXT )) pglTexParameterf( tex->target, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0f ); } @@ -950,8 +958,11 @@ static void GL_UploadTexture( rgbdata_t *pic, gltexture_t *tex, qboolean subImag if( tex->flags & TF_LUMINANCE ) { - GL_MakeLuminance( pic ); - tex->flags &= ~TF_LUMINANCE; + if( !( tex->flags & TF_DEPTHMAP )) + { + GL_MakeLuminance( pic ); + tex->flags &= ~TF_LUMINANCE; + } pic->flags &= ~IMAGE_HAS_COLOR; } diff --git a/engine/client/gl_studio.c b/engine/client/gl_studio.c index 64d9668e..ffcafe05 100644 --- a/engine/client/gl_studio.c +++ b/engine/client/gl_studio.c @@ -2419,43 +2419,19 @@ static void R_StudioClientEvents( void ) { mstudioseqdesc_t *pseqdesc; mstudioevent_t *pevent; - float flEventFrame; - qboolean bLooped = false; cl_entity_t *e = RI.currententity; + float f, start; int i; pseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + e->curstate.sequence; pevent = (mstudioevent_t *)((byte *)m_pStudioHeader + pseqdesc->eventindex); - // curstate.frame not used for viewmodel animating - flEventFrame = e->latched.prevframe; - - if( pseqdesc->numevents == 0 ) + // no events for this animation or gamepaused + if( pseqdesc->numevents == 0 || cl.time == cl.oldtime ) return; - if( e->syncbase == -0.01f ) - flEventFrame = 0.0f; - - // stalled? - if( flEventFrame == e->syncbase ) - return; - - //Msg( "(seq %d cycle %.3f ) evframe %.3f prevevframe %.3f (time %.3f)\n", e->curstate.sequence, e->latched.prevframe, flEventFrame, e->syncbase, RI.refdef.time ); - - // check for looping - if( flEventFrame <= e->syncbase ) - { - if( e->syncbase - flEventFrame > 0.5f ) - { - bLooped = true; - } - else - { - // things have backed up, which is bad since it'll probably result in a hitch in the animation playback - // but, don't play events again for the same time slice - return; - } - } + f = R_StudioEstimateFrame( e, pseqdesc ) + 0.01f; // get start offset + start = f - e->curstate.framerate * host.frametime * pseqdesc->fps; for( i = 0; i < pseqdesc->numevents; i++ ) { @@ -2463,20 +2439,9 @@ static void R_StudioClientEvents( void ) if( pevent[i].event < EVENT_CLIENT ) continue; - // looped - if( bLooped ) - { - if(( pevent[i].frame > e->syncbase || pevent[i].frame <= flEventFrame )) - clgame.dllFuncs.pfnStudioEvent( &pevent[i], e ); - } - else - { - if(( pevent[i].frame > e->syncbase && pevent[i].frame <= flEventFrame )) - clgame.dllFuncs.pfnStudioEvent( &pevent[i], e ); - } + if( (float)pevent[i].frame > start && f >= (float)pevent[i].frame ) + clgame.dllFuncs.pfnStudioEvent( &pevent[i], e ); } - - e->syncbase = flEventFrame; } /* diff --git a/engine/common/console.c b/engine/common/console.c index ad9251d0..0c80233d 100644 --- a/engine/common/console.c +++ b/engine/common/console.c @@ -621,6 +621,7 @@ int Con_DrawGenericString( int x, int y, const char *string, rgba_t setColor, qb if( *s == '\n' ) { s++; + if( !*s ) break; // at end the string drawLen = 0; // begin new row y += con.curFont->charHeight; } diff --git a/engine/common/imagelib/img_bmp.c b/engine/common/imagelib/img_bmp.c index 9122cf80..8c1177aa 100644 --- a/engine/common/imagelib/img_bmp.c +++ b/engine/common/imagelib/img_bmp.c @@ -425,7 +425,7 @@ qboolean Image_SaveBMP( const char *name, rgbdata_t *pix ) { i = (bmih.biHeight - 1 - y ) * (bmih.biWidth); - for( x = 0; x < bmih.biWidth; x++ ) + for( x = 0; x < pix->width; x++ ) { if( pixel_size == 1 ) { @@ -445,7 +445,7 @@ qboolean Image_SaveBMP( const char *name, rgbdata_t *pix ) i++; } - pb += bmih.biWidth * pixel_size; + pb += pix->width * pixel_size; } if( host.write_to_clipboard ) diff --git a/engine/server/sv_init.c b/engine/server/sv_init.c index a9ba800c..451e91f6 100644 --- a/engine/server/sv_init.c +++ b/engine/server/sv_init.c @@ -476,6 +476,11 @@ qboolean SV_SpawnServer( const char *mapname, const char *startspot ) Cmd_ExecuteString( "latch\n", src_command ); else MsgDev( D_ERROR, "SV_SpawnServer: while 'maxplayers' was modified.\n" ); + sv_maxclients->modified = false; + deathmatch->modified = false; + teamplay->modified = false; + coop->modified = false; + if( !svs.initialized ) return false;