507.patch

Ododo, 23.02.2019 15:51

Download (2.81 KB)

View differences:

src/cgame/cg_snapshot.c
56 56

  
57 57
	VectorCopy(cent->currentState.origin, cent->lerpOrigin);
58 58
	VectorCopy(cent->currentState.angles, cent->lerpAngles);
59

  
59 60
	if (cent->currentState.eType == ET_PLAYER)
60 61
	{
61 62
		CG_ResetPlayerEntity(cent);
......
111 112
		}
112 113
	}
113 114

  
115

  
116
	//If each frame since last CheckEvents olds entity number n
117
	//then cent will never be reset in CG_TransitionSnapshot and
118
	//so previousEvent will never return to 0. (condition cg_entities[id].currentValid == qfalse)
119
	// -> Ensure cent->previousEvent is 0 when a new event will occur..
120
	if(cent->nextState.eType < ET_EVENTS || 
121
		cent->currentState.otherEntityNum != cent->nextState.otherEntityNum ||
122
		cent->currentState.otherEntityNum2 != cent->nextState.otherEntityNum2)
123
	{
124
		cent->previousEvent = 0;
125
	}
126

  
127

  
114 128
	cent->currentState = cent->nextState;
115 129
	cent->currentValid = qtrue;
116 130

  
131

  
117 132
	// reset if the entity wasn't in the last frame or was teleported
118 133
	if (!cent->interpolate)
119 134
	{
......
290 305
	BG_PlayerStateToEntityState(&cg.snap->ps, &cg_entities[cg.snap->ps.clientNum].currentState, cg.time, qfalse);
291 306
	cg_entities[cg.snap->ps.clientNum].interpolate = qfalse;
292 307

  
293
	for (i = 0 ; i < cg.snap->numEntities ; i++)
294
	{
308

  
309
	for(i = 0; i < cg.snap->numEntities; i++){
295 310
		id = cg.snap->entities[i].number;
296 311
		CG_TransitionEntity(&cg_entities[id]);
297 312

  
298
		// ent doesn't exist in this frame, reset it.
299
		// this is to fix the silent landmines bug, which is caused
300
		// by a stale miscTime in the cent
301
		if (cg_entities[id].currentValid == qfalse && oldValid[id] == qtrue)
302
		{
303
			CG_ResetEntity(&cg_entities[id]);
304
		}
305

  
306 313
#ifdef FEATURE_MULTIVIEW
307 314
		if (cg.mvTotalClients > 0 && CG_mvMergedClientLocate(id))
308 315
		{
......
320 327

  
321 328
	cg.nextSnap = NULL;
322 329

  
323
	// check for playerstate transition events
330
	// check for playerstate transition events and entities that need reset from oldFrame
324 331
	if (oldFrame)
325 332
	{
333
		//Reset entity not valid in this frame but valid last frame.
334
		for (i = 0; i < oldFrame->numEntities; i++){
335
			id = oldFrame->entities[i].number;
336

  
337
			if(cg_entities[id].currentValid == qfalse && oldValid[id] == qtrue)
338
			{
339
				CG_ResetEntity(&cg_entities[id]);
340
			}
341
		}
342

  
326 343
		playerState_t *ops = &oldFrame->ps;
327 344
		playerState_t *ps  = &cg.snap->ps;
328 345

  
......
372 389

  
373 390
		// if this frame is a teleport, or the entity wasn't in the
374 391
		// previous frame, don't interpolate
392

  
375 393
		if (!cent->currentValid || ((cent->currentState.eFlags ^ es->eFlags) & EF_TELEPORT_BIT))
376 394
		{
377 395
			cent->interpolate = qfalse;