From 8caf0747f2265822c42a29d2017bd5176c663c80 Mon Sep 17 00:00:00 2001 From: garey Date: Sat, 1 Oct 2022 08:26:14 +0500 Subject: [PATCH] Hotfix --- src/animation.cpp | 4 +-- src/main.cpp | 88 ++++------------------------------------------- 2 files changed, 9 insertions(+), 83 deletions(-) diff --git a/src/animation.cpp b/src/animation.cpp index f845e76..420d6f1 100644 --- a/src/animation.cpp +++ b/src/animation.cpp @@ -16,7 +16,7 @@ typedef float real_t; extern player_anim_params_s player_params[MAX_CLIENTS]; int player = -1; edict_t* m_pCurrentEntity; - +extern qboolean nofind; int VectorCompare(const vec_t* v1, const vec_t* v2) { @@ -1124,7 +1124,7 @@ void EXT_FUNC CS_StudioSetupBones(model_t* pModel, float frame, int sequence, co static float pos4[MAXSTUDIOBONES][3]; static vec4_t q4[MAXSTUDIOBONES]; - if (!phf_hitbox_fix->value) + if (!phf_hitbox_fix->value || nofind) { orig_interface.SV_StudioSetupBones(pModel, frame, sequence, angles, origin, pcontroller, pblending, iBone, pEdict); return; diff --git a/src/main.cpp b/src/main.cpp index c712625..a5b92ba 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,7 +23,7 @@ sv_blending_interface_s orig_interface; // Resource counts #define MAX_MODEL_INDEX_BITS 9 // sent as a short #define MAX_MODELS (1<fakeclient) RETURN_META(MRES_IGNORED); - if (!MDLL_AllowLagCompensation()) - RETURN_META(MRES_IGNORED); - - if (sv_unlag->value == 0.0f || !_host_client->lw || !_host_client->lc) + if (!MDLL_AllowLagCompensation() || sv_unlag->value == 0.0f || !_host_client->lw || !_host_client->lc) + { RETURN_META(MRES_IGNORED); + } if (api->GetMaxClients() <= 1 || !_host_client->active) RETURN_META(MRES_IGNORED); - nofind = 0; - for (int i = 0; i < api->GetMaxClients(); i++) - { - cl = api->GetClient(i); - if (cl == _host_client || !cl->active) - continue; - - truepositions[i].active = 1; - truepositions[i].extra = player_params[i]; - } - - - if (SV_UPDATE_BACKUP <= 0) - { - memset(truepositions, 0, sizeof(truepositions)); - nofind = 1; - RETURN_META(MRES_IGNORED); - } size_t frame_index = SV_UPDATE_MASK & (_host_client->netchan.incoming_acknowledged); frame = &_host_client->frames[frame_index]; @@ -186,20 +165,9 @@ void (PlayerPreThinkPre)(edict_t* pEntity) if (cl == _host_client || !cl->active) continue; - pos = &truepositions[state->number - 1]; - if (pos->deadflag) - continue; - - if (!pos->active) - { - continue; - } - - static bool Init = false; - player_params[state->number - 1] = player_params_history[host_id].hist[frame_index][state->number - 1]; - - pos->needrelink = 1; + player_params[state->number - 1] = player_params_history[host_id].hist[frame_index][state->number - 1]; #ifdef DEBUG + static bool Init = false; if (!Init) { Init = true; @@ -896,49 +864,7 @@ void ProcessAnimParams(int id, int host_id, player_anim_params_s& params, player void PlayerPostThinkPost(edict_t* pEntity) { - int i; - auto id = ENTINDEX(pEntity) - 1; - auto _host_client = api->GetClient(id); - - sv_adjusted_positions_t* pos; - client_t* cli; - - if (_host_client->fakeclient) - RETURN_META(MRES_IGNORED); - - if (nofind) - { - nofind = 0; - RETURN_META(MRES_IGNORED); - } - - if (!MDLL_AllowLagCompensation()) - RETURN_META(MRES_IGNORED); - - if (api->GetMaxClients() <= 1 || sv_unlag->value == 0.0) - RETURN_META(MRES_IGNORED); - - if (!_host_client->lw || !_host_client->lc || !_host_client->active) - RETURN_META(MRES_IGNORED); - - for (int i = 0; i < api->GetMaxClients(); i++) - { - cli = api->GetClient(i); - pos = &truepositions[i]; - - if (cli == _host_client || !cli->active) - continue; - - if (!pos->needrelink) - continue; - - if (!pos->active) - { - continue; - } - - player_params[i] = truepositions[i].extra; - } + nofind = 0; RETURN_META(MRES_IGNORED); }