ttbs123 发表于 2008-12-13 18:18:06

请教个函数fwdAddToFullPack

fwdAddToFullPack( es_handle, e, ent, host, hostflags, player, pset )
弄不明白里面的参数代表什么,请高人指点:cry:

jim_yang 发表于 2008-12-13 18:40:38

回复: 请教个函数fwdAddToFullPack

/*
AddToFullPack
Return 1 if the entity state has been filled in for the ent and the entity will be propagated to the client, 0 otherwise
state is the server maintained copy of the state info that is transmitted to the client
a MOD could alter values copied into state to send the "host" a different look for a particular entity update, etc.
e and ent are the entity that is being added to the update, if 1 is returned
host is the player's edict of the player whom we are sending the update to
player is 1 if the ent/e is a player and 0 otherwise
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.
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
*/

jim_yang 发表于 2008-12-13 18:41:31

回复: 请教个函数fwdAddToFullPack

int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet )

ttbs123 发表于 2008-12-13 20:04:16

回复: 请教个函数fwdAddToFullPack

否则退回1,如果个体状态暂时代替了耳鼻喉科,并且个体将被繁殖给客户, 0
state是被传送给客户状态信息的服务器被维护的拷贝
a MOD可能修改价值被复制入状态送“主人”不同寻找一次特殊个体更新等等。
e和耳鼻喉科是增加到更新的个体,如果1返回
host是我们送更新球员的球员的法令如果ent/e否则,是球员和0 player是1
pSet是那舞步或的PVS我们早先设定。 我们可以使用它请求引擎过滤个体反对舞步或PVS。
we可能也使用我们在SetupVisibility设置的舞步pvs,如果我们要。 贮藏价值是仅合法的在那个案件,但是仍然为当前框架

ttbs123 发表于 2008-12-13 20:05:15

回复: 请教个函数fwdAddToFullPack

jim_yang大哥帮忙翻译一下啊,我网上翻译得一塌糊涂。。。。
这个函数现在好多插件有用到

jim_yang 发表于 2008-12-13 21:29:56

回复: 请教个函数fwdAddToFullPack

如果对 edict_t *ent 的entity state已经设置好并要发送至客户端,返回1,否则返回0
state是服务器端保持的一个送至客户端的state info的副本
一个MOD可以调整这个state副本的值使发送至host一个不一样的特殊entity更新。
e和ent就是要更新状态的entity
host就是要收到更新的entity
pset是之前设置的PAS和PVS,我们可以用它让引擎过滤entity

我翻译的也很烂,因为我一直是英语逻辑,从来不把英文翻译过来思考
另外我从来不用资源耗费大户,除了一个serverframe不得不用(amxx用来实现set task)
凡是一些几乎实时更新的函数我从来不hook
这个函数就更频繁了,服务器为了是每个玩家的状态保持同步会不断发送。
另外给你一个entity state这个结构的内容,里面这些值都可以来设置
// Entity state is used for the baseline and for delta compression of a packet of
//entities that is sent to a client.
typedef struct entity_state_s entity_state_t;
struct entity_state_s
{
// Fields which are filled in by routines outside of delta compression
int   entityType;
// Index into cl_entities array for this entity.
int   number;      
floatmsg_time;
// Message number last time the player/entity state was updated.
int   messagenum;
// Fields which can be transitted and reconstructed over the network stream
vec3_torigin;
vec3_tangles;
int   modelindex;
int   sequence;
floatframe;
int   colormap;
shortskin;
shortsolid;
int   effects;
floatscale;
byteeflags;

// Render information
int   rendermode;
int   renderamt;
color24rendercolor;
int   renderfx;
int   movetype;
floatanimtime;
floatframerate;
int   body;
bytecontroller;
byteblending;
vec3_tvelocity;
// Send bbox down to client for use during prediction.
vec3_tmins;   
vec3_tmaxs;
int   aiment;
// If owned by a player, the index of that player ( for projectiles ).
int   owner;
// Friction, for prediction.
floatfriction;      
// Gravity multiplier
floatgravity;
// PLAYER SPECIFIC
int   team;
int   playerclass;
int   health;
qboolean spectator;
int         weaponmodel;
int   gaitsequence;
// If standing on conveyor, e.g.
vec3_tbasevelocity;   
// Use the crouched hull, or the regular player hull.
int   usehull;
// Latched buttons last time state updated.
int   oldbuttons;   
// -1 = in air, else pmove entity number
int   onground;
int   iStepLeft;
// How fast we are falling
floatflFallVelocity;
floatfov;
int   weaponanim;
// Parametric movement overrides
vec3_t    startpos;
vec3_t    endpos;
float    impacttime;
float    starttime;
// For mods
int   iuser1;
int   iuser2;
int   iuser3;
int   iuser4;
floatfuser1;
floatfuser2;
floatfuser3;
floatfuser4;
vec3_tvuser1;
vec3_tvuser2;
vec3_tvuser3;
vec3_tvuser4;
};

ttbs123 发表于 2008-12-13 21:50:54

回复: 请教个函数fwdAddToFullPack

非常感谢jim_yang 大哥,虽然还是没弄懂。。。慢慢消化中。。。

ghost4.12 发表于 2010-5-2 21:13:40

头晕了这个没看懂啊
页: [1]
查看完整版本: 请教个函数fwdAddToFullPack