engine: client: replace same struct type memcpys by assignments

This commit is contained in:
Alibek Omarov 2024-07-31 00:04:57 +03:00
parent 712b354421
commit 47eb9e8c8f
8 changed files with 13 additions and 15 deletions

View file

@ -95,8 +95,7 @@ static void CL_ResetPositions( cl_entity_t *ent )
ent->current_position = 1; ent->current_position = 1;
memset( ent->ph, 0, sizeof( position_history_t ) * HISTORY_MAX ); memset( ent->ph, 0, sizeof( position_history_t ) * HISTORY_MAX );
memcpy( &ent->ph[1], &store, sizeof( position_history_t )); ent->ph[1] = ent->ph[0] = store;
memcpy( &ent->ph[0], &store, sizeof( position_history_t ));
} }
/* /*
@ -752,7 +751,7 @@ static void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_s
if( has_update ) if( has_update )
alive = MSG_ReadDeltaEntity( msg, old, state, newnum, delta_type, cl.mtime[0] ); alive = MSG_ReadDeltaEntity( msg, old, state, newnum, delta_type, cl.mtime[0] );
else memcpy( state, old, sizeof( entity_state_t )); else *state = *old;
if( !alive ) if( !alive )
{ {

View file

@ -1315,7 +1315,7 @@ qboolean UI_LoadProgs( void )
gameui.use_extended_api = false; gameui.use_extended_api = false;
// make local copy of engfuncs to prevent overwrite it with user dll // make local copy of engfuncs to prevent overwrite it with user dll
memcpy( &gpEngfuncs, &gEngfuncs, sizeof( gpEngfuncs )); gpEngfuncs = gEngfuncs;
gameui.mempool = Mem_AllocPool( "Menu Pool" ); gameui.mempool = Mem_AllocPool( "Menu Pool" );
@ -1329,7 +1329,7 @@ qboolean UI_LoadProgs( void )
} }
// make local copy of engfuncs to prevent overwrite it with user dll // make local copy of engfuncs to prevent overwrite it with user dll
memcpy( &gpExtendedfuncs, &gExtendedfuncs, sizeof( gExtendedfuncs )); gpExtendedfuncs = gExtendedfuncs;
memset( &gameui.dllFuncs2, 0, sizeof( gameui.dllFuncs2 )); memset( &gameui.dllFuncs2, 0, sizeof( gameui.dllFuncs2 ));
// try to initialize new extended API // try to initialize new extended API

View file

@ -2670,7 +2670,7 @@ void CL_ProcessFile( qboolean successfully_received, const char *filename )
else else
{ {
Con_Printf( "Downloaded %i bytes for purported %i byte file, ignoring download\n", Con_Printf( "Downloaded %i bytes for purported %i byte file, ignoring download\n",
cls.netchan.tempbuffersize, p->nDownloadSize ); cls.netchan.tempbuffersize, p->nDownloadSize );
} }
if( cls.netchan.tempbuffer ) if( cls.netchan.tempbuffer )

View file

@ -123,7 +123,7 @@ qboolean Mobile_Init( void )
{ {
static mobile_engfuncs_t mobile_engfuncs; // keep a copy, don't let user change engine pointers static mobile_engfuncs_t mobile_engfuncs; // keep a copy, don't let user change engine pointers
memcpy( &mobile_engfuncs, &gMobileEngfuncs, sizeof( mobile_engfuncs )); mobile_engfuncs = gMobileEngfuncs;
if( !ExportToClient( &mobile_engfuncs )) if( !ExportToClient( &mobile_engfuncs ))
{ {

View file

@ -251,7 +251,7 @@ void CL_ParseMovevars( sizebuf_t *msg )
if( Q_strcmp( clgame.oldmovevars.skyName, clgame.movevars.skyName ) && cl.video_prepped ) if( Q_strcmp( clgame.oldmovevars.skyName, clgame.movevars.skyName ) && cl.video_prepped )
R_SetupSky( clgame.movevars.skyName ); R_SetupSky( clgame.movevars.skyName );
memcpy( &clgame.oldmovevars, &clgame.movevars, sizeof( movevars_t )); clgame.oldmovevars = clgame.movevars;
clgame.entities->curstate.scale = clgame.movevars.waveHeight; clgame.entities->curstate.scale = clgame.movevars.waveHeight;
// keep features an actual! // keep features an actual!
@ -1403,7 +1403,7 @@ void CL_UpdateUserinfo( sizebuf_t *msg, qboolean legacy )
if( !legacy ) if( !legacy )
MSG_ReadBytes( msg, player->hashedcdkey, sizeof( player->hashedcdkey )); MSG_ReadBytes( msg, player->hashedcdkey, sizeof( player->hashedcdkey ));
if( slot == cl.playernum ) memcpy( &gameui.playerinfo, player, sizeof( player_info_t )); if( slot == cl.playernum ) gameui.playerinfo = *player;
} }
else else
{ {

View file

@ -328,7 +328,7 @@ static void CL_ParseQuakeServerInfo( sizebuf_t *msg )
clgame.movevars.gravity = 800.0f; // quake doesn't write gravity in demos clgame.movevars.gravity = 800.0f; // quake doesn't write gravity in demos
clgame.movevars.maxvelocity = 2000.0f; clgame.movevars.maxvelocity = 2000.0f;
memcpy( &clgame.oldmovevars, &clgame.movevars, sizeof( movevars_t )); clgame.oldmovevars = clgame.movevars;
} }
/* /*
@ -715,8 +715,7 @@ static void CL_ParseQuakeBaseline( sizebuf_t *msg )
ent = CL_EDICT_NUM( newnum ); ent = CL_EDICT_NUM( newnum );
ent->index = newnum; ent->index = newnum;
ent->player = CL_IsPlayerIndex( newnum ); ent->player = CL_IsPlayerIndex( newnum );
memcpy( &ent->baseline, &state, sizeof( entity_state_t )); ent->prevstate = ent->baseline = state;
memcpy( &ent->prevstate, &state, sizeof( entity_state_t ));
} }
/* /*

View file

@ -491,7 +491,7 @@ static qboolean R_LoadProgs( const char *name )
} }
// make local copy of engfuncs to prevent overwrite it with user dll // make local copy of engfuncs to prevent overwrite it with user dll
memcpy( &gpEngfuncs, &gEngfuncs, sizeof( gpEngfuncs )); gpEngfuncs = gEngfuncs;
if( GetRefAPI( REF_API_VERSION, &ref.dllFuncs, &gpEngfuncs, &refState ) != REF_API_VERSION ) if( GetRefAPI( REF_API_VERSION, &ref.dllFuncs, &gpEngfuncs, &refState ) != REF_API_VERSION )
{ {

View file

@ -282,7 +282,7 @@ qboolean VGui_LoadProgs( HINSTANCE hInstance )
void (*F)( vguiapi_t* ); void (*F)( vguiapi_t* );
qboolean client = hInstance != NULL; qboolean client = hInstance != NULL;
memcpy( &vgui.dllFuncs, &gEngfuncs, sizeof( vgui.dllFuncs )); vgui.dllFuncs = gEngfuncs;
// not loading interface from client.dll, load vgui_support.dll instead // not loading interface from client.dll, load vgui_support.dll instead
if( !client ) if( !client )
@ -373,7 +373,7 @@ void VGui_Shutdown( void )
COM_FreeLibrary( vgui.hInstance ); COM_FreeLibrary( vgui.hInstance );
// drop pointers to now unloaded vgui_support // drop pointers to now unloaded vgui_support
memcpy( &vgui.dllFuncs, &gEngfuncs, sizeof( vgui.dllFuncs )); vgui.dllFuncs = gEngfuncs;
vgui.hInstance = NULL; vgui.hInstance = NULL;
} }