diff --git a/change.log b/change.log index 8427d9b2..ffbf4dcd 100644 --- a/change.log +++ b/change.log @@ -1,4 +1,4 @@ -build ???? +build 1905 Physic: fix trace bug when model is missing Client: implement function TriScreenToWorld @@ -13,6 +13,10 @@ Render: fix a little bug with engine mirrors Sound: implement separate volume controls for background track and game sounds Sound: fix wrong position for dynamic sounds in case parent entity never has updates on the client Client: first implementation of extended engineinterface. +Server: fix bug with update movevars after the server initialization. +Input: cancel mouse movement while switches between menu\console and game +Render: added function R_EntityRemoveDecals into RendererInterface +Render: fixed bug with crash engine on custom resolutions while makes a screenshot (e.g. 1366x768) build 1850 diff --git a/common/render_api.h b/common/render_api.h index 0ce46b27..b52a492b 100644 --- a/common/render_api.h +++ b/common/render_api.h @@ -163,6 +163,9 @@ typedef struct render_api_s void (*GL_TexMatrixIdentity)( void ); void (*GL_CleanUpTextureUnits)( int last ); // pass 0 for clear all the texture units void (*GL_TexGen)( unsigned int coord, unsigned int mode ); + +// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 26 + void (*R_EntityRemoveDecals)( model_t *mod ); // remove all the decals from specified entity (BSP only) } render_api_t; // render callbacks diff --git a/engine/client/cl_frame.c b/engine/client/cl_frame.c index 909adc2e..5cebbdac 100644 --- a/engine/client/cl_frame.c +++ b/engine/client/cl_frame.c @@ -418,6 +418,9 @@ void CL_UpdateStudioVars( cl_entity_t *ent, entity_state_t *newstate, qboolean n 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/gl_backend.c b/engine/client/gl_backend.c index 8d90608c..78a8072d 100644 --- a/engine/client/gl_backend.c +++ b/engine/client/gl_backend.c @@ -421,8 +421,8 @@ qboolean VID_ScreenShot( const char *filename, int shot_type ) qboolean result; r_shot = Mem_Alloc( r_temppool, sizeof( rgbdata_t )); - r_shot->width = glState.width; - r_shot->height = glState.height; + r_shot->width = (glState.width + 3) & ~3; + r_shot->height = (glState.height + 3) & ~3; r_shot->flags = IMAGE_HAS_COLOR; r_shot->type = PF_RGB_24; r_shot->size = r_shot->width * r_shot->height * PFDesc[r_shot->type].bpp; @@ -430,7 +430,7 @@ qboolean VID_ScreenShot( const char *filename, int shot_type ) r_shot->buffer = Mem_Alloc( r_temppool, r_shot->size ); // get screen frame - pglReadPixels( 0, 0, glState.width, glState.height, GL_RGB, GL_UNSIGNED_BYTE, r_shot->buffer ); + pglReadPixels( 0, 0, r_shot->width, r_shot->height, GL_RGB, GL_UNSIGNED_BYTE, r_shot->buffer ); switch( shot_type ) { diff --git a/engine/client/gl_decals.c b/engine/client/gl_decals.c index ec1e46c8..fea5bb0e 100644 --- a/engine/client/gl_decals.c +++ b/engine/client/gl_decals.c @@ -1106,4 +1106,28 @@ void R_DecalRemoveAll( int textureIndex ) if( !textureIndex || pdecal->texture == textureIndex ) R_DecalUnlink( pdecal ); } +} + +/* +=============== +R_EntityRemoveDecals + +remove all decals from specified entity +=============== +*/ +void R_EntityRemoveDecals( model_t *mod ) +{ + msurface_t *psurf; + decal_t *p; + int i; + + if( !mod || mod->type != mod_brush ) + return; + + psurf = &mod->surfaces[mod->firstmodelsurface]; + for( i = 0; i < mod->nummodelsurfaces; i++, psurf++ ) + { + for( p = psurf->pdecals; p; p = p->pnext ) + R_DecalUnlink( p ); + } } \ No newline at end of file diff --git a/engine/client/gl_image.c b/engine/client/gl_image.c index 55578287..cf7db1cc 100644 --- a/engine/client/gl_image.c +++ b/engine/client/gl_image.c @@ -1372,7 +1372,8 @@ void GL_FreeTexture( GLenum texnum ) if( !image->name[0] ) { - Msg( "Trying to free unnamed texture with texnum %i\n", image->texnum ); + if( image->texnum != 0 ) + MsgDev( D_ERROR, "trying to free unnamed texture with texnum %i\n", image->texnum ); return; } diff --git a/engine/client/gl_local.h b/engine/client/gl_local.h index 845b09f9..fc07e12c 100644 --- a/engine/client/gl_local.h +++ b/engine/client/gl_local.h @@ -285,6 +285,7 @@ qboolean R_CullSurface( msurface_t *surf, uint clipflags ); // void DrawSurfaceDecals( msurface_t *fa ); void DrawSingleDecal( decal_t *pDecal, msurface_t *fa ); +void R_EntityRemoveDecals( model_t *mod ); void R_ClearDecals( void ); // diff --git a/engine/client/gl_rmain.c b/engine/client/gl_rmain.c index ae0108aa..42db22f0 100644 --- a/engine/client/gl_rmain.c +++ b/engine/client/gl_rmain.c @@ -1501,6 +1501,7 @@ static render_api_t gRenderAPI = GL_LoadIdentityTexMatrix, GL_CleanUpTextureUnits, GL_TexGen, + R_EntityRemoveDecals, }; /* diff --git a/engine/common/build.c b/engine/common/build.c index 8f46e4db..c2be100a 100644 --- a/engine/common/build.c +++ b/engine/common/build.c @@ -23,7 +23,7 @@ static char mond[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; int Q_buildnum( void ) { // do not touch this! Only author of Xash3D can increase buildnumbers! -#if 1 +#if 0 int m = 0, d = 0, y = 0; static int b = 0; @@ -48,6 +48,6 @@ int Q_buildnum( void ) return b; #else - return 1613; + return 1905; #endif } \ No newline at end of file diff --git a/engine/common/input.c b/engine/common/input.c index 69887c55..013e1f49 100644 --- a/engine/common/input.c +++ b/engine/common/input.c @@ -178,6 +178,8 @@ void IN_ToggleClientMouse( int newstate, int oldstate ) } else if( newstate == key_game ) { + // reset mouse pos, so cancel effect in game + SetCursorPos( host.window_center_x, host.window_center_y ); clgame.dllFuncs.IN_ActivateMouse(); } diff --git a/engine/server/server.h b/engine/server/server.h index 1457208c..35bc4bd3 100644 --- a/engine/server/server.h +++ b/engine/server/server.h @@ -403,7 +403,7 @@ extern convar_t *physinfo; // void SV_FinalMessage( char *message, qboolean reconnect ); void SV_DropClient( sv_client_t *drop ); - +void SV_UpdateMovevars( qboolean initialize ); int SV_ModelIndex( const char *name ); int SV_SoundIndex( const char *name ); int SV_EventIndex( const char *name ); diff --git a/engine/server/sv_init.c b/engine/server/sv_init.c index 0bff5f85..7ccaa699 100644 --- a/engine/server/sv_init.c +++ b/engine/server/sv_init.c @@ -647,6 +647,9 @@ void SV_InitGame( void ) svs.clients[i].edict = ent; } + // get actual movevars + SV_UpdateMovevars( true ); + svgame.numEntities = svgame.globals->maxClients + 1; // clients + world svs.initialized = true; } diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index 73cf658e..e28fe3c5 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -196,9 +196,10 @@ check movevars for changes every frame send updates to client if changed =================== */ -void SV_UpdateMovevars( void ) +void SV_UpdateMovevars( qboolean initialize ) { - if( !physinfo->modified ) return; + if( !initialize && !physinfo->modified ) + return; // check range if( sv_zmax->value < 256.0f ) Cvar_SetFloat( "sv_zmax", 256.0f ); @@ -235,6 +236,8 @@ void SV_UpdateMovevars( void ) svgame.movevars.skyangle = sv_skyangle->value; svgame.movevars.wateralpha = sv_wateralpha->value; + if( initialize ) return; + if( MSG_WriteDeltaMovevars( &sv.reliable_datagram, &svgame.oldmovevars, &svgame.movevars )) Q_memcpy( &svgame.oldmovevars, &svgame.movevars, sizeof( movevars_t )); // oldstate changed @@ -543,7 +546,7 @@ void Host_ServerFrame( void ) SV_UpdateServerInfo (); // refresh physic movevars on the client side - SV_UpdateMovevars (); + SV_UpdateMovevars ( false ); // let everything in the world think and move SV_RunGameFrame (); diff --git a/engine/server/sv_move.c b/engine/server/sv_move.c index a1102af9..dc7069da 100644 --- a/engine/server/sv_move.c +++ b/engine/server/sv_move.c @@ -175,7 +175,6 @@ qboolean SV_MoveStep( edict_t *ent, vec3_t move, qboolean relink ) } else { - dz = svgame.movevars.stepsize; neworg[2] += dz; VectorCopy( neworg, end ); diff --git a/game_launch/hl.exe b/game_launch/hl.exe index 60d8feb9..6a1b6aaf 100644 Binary files a/game_launch/hl.exe and b/game_launch/hl.exe differ