engine: server: fix restoring player view entity after save restore (fixes trigger_camera usage)

This commit is contained in:
Alibek Omarov
2025-06-19 15:22:54 +05:00
parent 05a258a5b4
commit 7e50026100

View File

@@ -307,7 +307,6 @@ static void SV_ConnectClient( netadr_t from )
{
char userinfo[MAX_INFO_STRING];
char protinfo[MAX_INFO_STRING];
char physinfo[MAX_INFO_STRING];
client_frame_t *frames;
sv_client_t *newcl = NULL;
int qport, version;
@@ -416,12 +415,20 @@ static void SV_ConnectClient( netadr_t from )
frames = Mem_Realloc( host.mempool, newcl->frames, sizeof( client_frame_t ) * SV_UPDATE_BACKUP );
memset( frames, 0, sizeof( client_frame_t ) * SV_UPDATE_BACKUP );
SV_ClearResourceLists( newcl );
memcpy( physinfo, newcl->physinfo, sizeof( physinfo ));
memset( newcl, 0, sizeof( *newcl ));
// a1ba: preserve physinfo and viewent as it's set by game logic before client connect!
{
char physinfo[MAX_INFO_STRING];
edict_t *viewent = newcl->pViewEntity;
memcpy( physinfo, newcl->physinfo, sizeof( physinfo ));
memset( newcl, 0, sizeof( *newcl ));
memcpy( newcl->physinfo, physinfo, sizeof( newcl->physinfo ));
newcl->pViewEntity = viewent;
}
// a1ba: preserve physinfo as it's set by game logic, before client connect!
memcpy( newcl->physinfo, physinfo, sizeof( newcl->physinfo ));
newcl->edict = EDICT_NUM(( newcl - svs.clients ) + 1 );
newcl->frames = frames;
newcl->userid = g_userid++; // create unique userid