diff --git a/.gitignore b/.gitignore index 6461f11..c56282d 100644 --- a/.gitignore +++ b/.gitignore @@ -447,3 +447,5 @@ dkms.conf *.exe *.out *.app + +CMakeSettings.json \ No newline at end of file diff --git a/src/animation.cpp b/src/animation.cpp index 559de9f..e50dde5 100644 --- a/src/animation.cpp +++ b/src/animation.cpp @@ -344,12 +344,10 @@ mstudioanim_t* StudioGetAnim(model_t* m_pSubModel, mstudioseqdesc_t* pseqdesc) paSequences = (cache_user_t*)IEngineStudio.Mem_Calloc(16, sizeof(cache_user_t)); // UNDONE: leak! m_pSubModel->submodels = (dmodel_t*)paSequences; } -#if 0 // todo there crash in some servers if (!IEngineStudio.Cache_Check((struct cache_user_s*)&(paSequences[pseqdesc->seqgroup]))) { IEngineStudio.LoadCacheFile(pseqgroup->name, (struct cache_user_s*)&paSequences[pseqdesc->seqgroup]); } -#endif return (mstudioanim_t*)((byte*)paSequences[pseqdesc->seqgroup].data + pseqdesc->animindex); } @@ -921,7 +919,7 @@ void EXT_FUNC SV_StudioSetupBones(model_t* pModel, float frame, int sequence, co g_pstudiohdr = (studiohdr_t*)IEngineStudio.Mod_Extradata(pModel); // Bound sequence number - if (sequence < 0 || sequence >= g_pstudiohdr->numseq) + if (!g_pstudiohdr || sequence < 0 || sequence >= g_pstudiohdr->numseq) sequence = 0; pbones = (mstudiobone_t*)((byte*)g_pstudiohdr + g_pstudiohdr->boneindex); @@ -1078,7 +1076,7 @@ void EXT_FUNC SV_StudioSetupBones(model_t* pModel, float frame, int sequence, co if ( player_params[player].sequencetime && (player_params[player].sequencetime + 0.2 > player_params[player].m_clTime) && - (player_params[player].prevsequence < g_pstudiohdr->numseq)) + (player_params[player].prevsequence >= 0 && player_params[player].prevsequence < g_pstudiohdr->numseq)) { // blend from last sequence static float pos1b[MAXSTUDIOBONES][3]; diff --git a/src/main.cpp b/src/main.cpp index 9850d8d..d59d36a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -466,6 +466,9 @@ void PlayerPostThinkPost(edict_t* pEntity) player_params[id].controller[3] = _host_client->edict->v.controller[3]; player_params[id].blending[0] = _host_client->edict->v.blending[0]; player_params[id].blending[1] = _host_client->edict->v.blending[1]; + if (player_params[id].sequence < 0) + player_params[id].sequence = 0; + // sequence has changed, hold the previous sequence info if (player_params[id].sequence != player_params[id].prevsequence) { @@ -584,6 +587,10 @@ int (AddToFullPackPost)(struct entity_state_s* state, int e, edict_t* ent, edict player_params[id].prevangles = player_params_history[host_id].hist[SV_UPDATE_MASK & (_host_client->netchan.outgoing_sequence)][id].angles; player_params[id].prevframe = player_params_history[host_id].hist[SV_UPDATE_MASK & (_host_client->netchan.outgoing_sequence)][id].frame; player_params[id].prevsequence = player_params_history[host_id].hist[SV_UPDATE_MASK & (_host_client->netchan.outgoing_sequence)][id].sequence; + + if (player_params[id].sequence < 0) + player_params[id].sequence = 0; + // sequence has changed, hold the previous sequence info if (player_params[id].sequence != player_params[id].prevsequence) {