summaryrefslogtreecommitdiff
path: root/engine/changeframelist.h
blob: 17ac034dbbd8888f9f61b8c393ca84cb29992a5c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

#ifndef CHANGEFRAMELIST_H
#define CHANGEFRAMELIST_H
#ifdef _WIN32
#pragma once
#endif


#include "bitbuf.h"


// This class holds the last tick (from host_tickcount) that each property in 
// a datatable changed at.
//
// It provides fast access to a list of properties that changed within a certain frame range.
//
// These are created once per entity per frame. Since usually a very small percentage of an
// entity's properties actually change each frame, this allows you to get a small set of 
// properties to delta for each client.
abstract_class IChangeFrameList
{
public:
	
	// Call this to delete the object.
	virtual void	Release() = 0;

	// This just returns the value you passed into AllocChangeFrameList().
	virtual int		GetNumProps() = 0;

	// Sets the change frames for the specified properties to iFrame.
	virtual void	SetChangeTick( const int *pPropIndices, int nPropIndices, const int iTick ) = 0;

	// Get a list of all properties with a change frame > iFrame.
	virtual int		GetPropsChangedAfterTick( int iTick, int *iOutProps, int nMaxOutProps ) = 0;

	virtual IChangeFrameList* Copy() = 0; // return a copy of itself


protected:
	// Use Release to delete these.
	virtual			~IChangeFrameList() {}
};				


// Call to initialize. Pass in the number of properties this CChangeFrameList will hold.
// All properties will be initialized to iCurFrame.
IChangeFrameList* AllocChangeFrameList( int nProperties, int iCurFrame );


#endif // CHANGEFRAMELIST_H