mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-01 01:25:38 +03:00
Merge pull request #272 from WPMGPRoSToTeMa/AttachedEntitiesPlayerAnimationSpeedBugFix
Fixed animation speed when player has attached entities
This commit is contained in:
commit
b8f4617509
@ -538,6 +538,7 @@ extern cvar_t sv_rehlds_force_dlmax;
|
||||
extern cvar_t sv_rehlds_hull_centering;
|
||||
extern cvar_t sv_rcon_condebug;
|
||||
extern cvar_t sv_rehlds_userinfo_transmitted_fields;
|
||||
extern cvar_t sv_rehlds_attachedentities_playeranimationspeed_fix;
|
||||
#endif
|
||||
extern int sv_playermodel;
|
||||
|
||||
|
@ -307,6 +307,7 @@ cvar_t syserror_logfile = { "syserror_logfile", "sys_error.log", 0, 0.0f, nullpt
|
||||
cvar_t sv_rehlds_hull_centering = { "sv_rehlds_hull_centering", "0", 0, 0.0f, nullptr };
|
||||
cvar_t sv_rcon_condebug = { "sv_rcon_condebug", "1", 0, 1.0f, nullptr };
|
||||
cvar_t sv_rehlds_userinfo_transmitted_fields = { "sv_rehlds_userinfo_transmitted_fields", "", 0, 0.0f, nullptr };
|
||||
cvar_t sv_rehlds_attachedentities_playeranimationspeed_fix = {"sv_rehlds_attachedentities_playeranimationspeed_fix", "", 0, 0.0f, nullptr};
|
||||
#endif
|
||||
|
||||
delta_t *SV_LookupDelta(char *name)
|
||||
@ -4518,7 +4519,7 @@ void SV_WriteEntitiesToClient(client_t *client, sizebuf_t *msg)
|
||||
for (e = 1; e <= g_psvs.maxclients; e++)
|
||||
{
|
||||
client_t *cl = &g_psvs.clients[e - 1];
|
||||
if( ( !cl->active && !cl->spawned ) || cl->proxy )
|
||||
if ((!cl->active && !cl->spawned) || cl->proxy)
|
||||
continue;
|
||||
|
||||
qboolean add = gEntityInterface.pfnAddToFullPack(&curPack->entities[curPack->num_entities], e, &g_psv.edicts[e], host_client->edict, flags, TRUE, pSet);
|
||||
@ -4552,6 +4553,32 @@ void SV_WriteEntitiesToClient(client_t *client, sizebuf_t *msg)
|
||||
|
||||
}
|
||||
|
||||
#ifdef REHLDS_FIXES
|
||||
if (sv_rehlds_attachedentities_playeranimationspeed_fix.value != 0)
|
||||
{
|
||||
int attachedEntCount[MAX_CLIENTS + 1] = {};
|
||||
for (int i = curPack->num_entities - 1; i >= 0; i--)
|
||||
{
|
||||
auto &entityState = curPack->entities[i];
|
||||
if (entityState.number > MAX_CLIENTS)
|
||||
{
|
||||
if (entityState.movetype == MOVETYPE_FOLLOW
|
||||
&& 1 <= entityState.aiment && entityState.aiment <= MAX_CLIENTS)
|
||||
{
|
||||
attachedEntCount[entityState.aiment]++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (attachedEntCount[entityState.number] != 0)
|
||||
{
|
||||
entityState.framerate /= (1 + attachedEntCount[entityState.number]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//for REHLDS_FIXES: Entities are already in the frame's storage, no need to copy them
|
||||
#ifndef REHLDS_OPT_PEDANTIC
|
||||
SV_AllocPacketEntities(frame, fullpack.num_entities);
|
||||
@ -7692,6 +7719,7 @@ void SV_Init(void)
|
||||
Cvar_RegisterVariable(&sv_rehlds_hull_centering);
|
||||
Cvar_RegisterVariable(&sv_rcon_condebug);
|
||||
Cvar_RegisterVariable(&sv_rehlds_userinfo_transmitted_fields);
|
||||
Cvar_RegisterVariable(&sv_rehlds_attachedentities_playeranimationspeed_fix);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < MAX_MODELS; i++)
|
||||
|
Loading…
Reference in New Issue
Block a user