Привет всем! Извините, пожалуйста, за много букв. Пытаюсь ясно объяснить вопрос .
Как я слышал, данные энтити передаются тогда, когда они поменяются, т. е. если меняется pev->friction, то тогда это значение передаётся клиенту и остальные также.
Может тута
C++ Source Code:
1
/*
2
=========================
3
HUD_ProcessPlayerState
4
5
We have received entity_state_t for this player over the network. We need to copy appropriate fields to the
// Save off some data so other areas of the Client DLL can get to it
51
cl_entity_t *player = GET_LOCAL_PLAYER(); // Get the local player's index
52
53
if( dst->number == player->index )
54
{
55
// always have valid PVS message
56
r_currentMessageNum = src->messagenum;
57
}
58
}
Или здесь
C++ Source Code:
1
/*
2
AddToFullPack
3
4
Return 1 if the entity state has been filled in for the ent and the entity will be propagated to the client, 0 otherwise
5
6
state is the server maintained copy of the state info that is transmitted to the client
7
a MOD could alter values copied into state to send the "host" a different look for a particular entity update, etc.
8
e and ent are the entity that is being added to the update, if 1 is returned
9
host is the player's edict of the player whom we are sending the update to
10
player is 1 if the ent/e is a player and 0 otherwise
11
pSet is either the PAS or PVS that we previous set up. We can use it to ask the engine to filter the entity against the PAS or PVS.
12
we could also use the pas/ pvs that we set in SetupVisibility, if we wanted to. Caching the value is valid in that case, but still only for the current frame
13
*/
14
int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsignedchar *pSet )
15
{
16
...
17
18
state->rendermode = ent->v.rendermode;
19
state->renderamt = ent->v.renderamt;
20
state->renderfx = ent->v.renderfx;
21
state->rendercolor.r = ent->v.rendercolor.x;
22
state->rendercolor.g = ent->v.rendercolor.y;
23
state->rendercolor.b = ent->v.rendercolor.z;
24
state->fuser2 = ent->v.fuser2; // FOV
25
state->iuser1 = ent->v.iuser1; // flags
26
state->iuser2 = ent->v.iuser2; // flags
27
state->vuser2 = ent->v.vuser2;
28
29
state->aiment = 0;
30
if ( ent->v.aiment )
31
{
32
state->aiment = ENTINDEX( ent->v.aiment );
33
}
34
35
state->owner = 0;
36
if ( ent->v.owner )
37
{
38
int owner = ENTINDEX( ent->v.owner );
39
40
// Only care if owned by a player
41
if ( owner >= 1 && owner <= gpGlobals->maxClients )
42
{
43
state->owner = owner;
44
}
45
}
46
47
// HACK: Somewhat...
48
// Class is overridden for non-players to signify a breakable glass object ( sort of a class? )
И как тогда отловить смену переменной gaitsequence и передать prevgaitsequence клиенту? Или же лучше сделать это на клиенте, а именно в void CStudioModelRenderer :: StudioSetupBones ( void )? Хотя в void CStudioModelRenderer :: StudioSetupBones ( void ) нежелательно, потому-что она и так часто вызывается, а тут ещё проверка такая
C++ Source Code:
1
if ( m_pPlayerInfo )
2
{
3
if ( m_pPlayerInfo->iPrevGaitSeq != m_pPlayerInfo->gaitsequence )
ILZM ты напиши, что конкретно ты хочешь сделать, отсюда и будем плясать. Естественно, гейтсеквенции и секвенции лучше отловить в коде студиомодельрендерера, т.к. там они обновляются каждый кадр, да и вообще имеется широкий доступ к параметрам модели. А ещё там можно получить доступ к некоторым энтварсам текущей энтити, для которой рисуется модель.
ЕМНИП, то на клиенте в студимодельрендерере её не получить. Придётся отлавливать через обновление инфы игрока. Вообще, в структуре cl_entity_t->curstate нету prevgaitsequence, да и не нужно оно на клиенте. Поэтому придётся либо мессагой, либо эвентом. Вопрос зачем оно тебе надо? Что за задача такая?
Это в движке и очень глубоко. Там абстрактный уровень. ты не отловишь свои pev->friction. Но если интересно - копай ent_encode.c функцию Delta_CompareField. Все сравнения происходят там.
Цитата:
ILZM писал: создаётся же для каждого игрока (За исключением местного игрока если он не от третьего лица)?
Местный игрок? Эй, игрок, ты с какова раёна?
Для всех игроков он создается, без исключения.
Цитата:
ILZM писал: Хочу переменную, которая хранит предыдущую gaitsequence, т. е. prevgaitsequence.
Хым. entity->prevstate.gaitsequence. Только зачем?
Добавлено 24-04-2014 в 15:19:
Цитата:
ILZM писал: Это надо всё чтобы сделать плавный переход анимаций ног у игрока, а то как отмороженный бегает.
Бгг. Не сделаешь. Я уже делал, такая фигня получилась. И аналогично - блендинг между секвенциями вьюмодели.