搜索
查看: 2951|回复: 7

请教个函数fwdAddToFullPack

[复制链接]
发表于 2008-12-13 18:18:06 | 显示全部楼层 |阅读模式 来自 广东深圳
fwdAddToFullPack( es_handle, e, ent, host, hostflags, player, pset )
弄不明白里面的参数代表什么,请高人指点:cry:
发表于 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
*/
回复

使用道具 举报

发表于 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 )
回复

使用道具 举报

 楼主| 发表于 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,如果我们要。 贮藏价值是仅合法的在那个案件,但是仍然为当前框架
回复

使用道具 举报

 楼主| 发表于 2008-12-13 20:05:15 | 显示全部楼层 来自 广东深圳

回复: 请教个函数fwdAddToFullPack

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;      
float  msg_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_t  origin;
vec3_t  angles;
int   modelindex;
int   sequence;
float  frame;
int   colormap;
short  skin;
short  solid;
int   effects;
float  scale;
byte  eflags;

// Render information
int   rendermode;
int   renderamt;
color24  rendercolor;
int   renderfx;
int   movetype;
float  animtime;
float  framerate;
int   body;
byte  controller[4];
byte  blending[4];
vec3_t  velocity;
// Send bbox down to client for use during prediction.
vec3_t  mins;   
vec3_t  maxs;
int   aiment;
// If owned by a player, the index of that player ( for projectiles ).
int   owner;
// Friction, for prediction.
float  friction;      
// Gravity multiplier
float  gravity;  
// PLAYER SPECIFIC
int   team;
int   playerclass;
int   health;
qboolean spectator;  
int         weaponmodel;
int   gaitsequence;
// If standing on conveyor, e.g.
vec3_t  basevelocity;   
// 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
float  flFallVelocity;  
float  fov;
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;
float  fuser1;
float  fuser2;
float  fuser3;
float  fuser4;
vec3_t  vuser1;
vec3_t  vuser2;
vec3_t  vuser3;
vec3_t  vuser4;
};
回复

使用道具 举报

 楼主| 发表于 2008-12-13 21:50:54 | 显示全部楼层 来自 广东深圳

回复: 请教个函数fwdAddToFullPack

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

使用道具 举报

发表于 2010-5-2 21:13:40 | 显示全部楼层 来自 重庆
头晕了  这个没看懂啊
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表