本文整理汇总了C++中MSG_ReadCoord函数的典型用法代码示例。如果您正苦于以下问题:C++ MSG_ReadCoord函数的具体用法?C++ MSG_ReadCoord怎么用?C++ MSG_ReadCoord使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MSG_ReadCoord函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Parse_Damage
void Parse_Damage(void){
MSG_ReadByte(); //armor
MSG_ReadByte(); //blood
MSG_ReadCoord(); //coords
MSG_ReadCoord();
MSG_ReadCoord();
}
示例2: CL_ParseDelta
/*
==================
CL_ParseDelta
Can go from either a baseline or a previous packet_entity
==================
*/
static void
CL_ParseDelta(entity_state_t *from, entity_state_t *to, int bits)
{
int i;
// set everything to the state we are delta'ing from
*to = *from;
to->number = bits & 511;
bits &= ~511;
if (bits & U_MOREBITS) { // read in the low order bits
i = MSG_ReadByte();
bits |= i;
}
to->flags = bits;
if (bits & U_MODEL)
to->modelindex = MSG_ReadByte();
if (bits & U_FRAME)
to->frame = MSG_ReadByte();
if (bits & U_COLORMAP)
to->colormap = MSG_ReadByte();
if (bits & U_SKIN)
to->skinnum = MSG_ReadByte();
if (bits & U_EFFECTS)
to->effects = MSG_ReadByte();
if (bits & U_ORIGIN1)
to->origin[0] = MSG_ReadCoord();
if (bits & U_ANGLE1)
to->angles[0] = MSG_ReadAngle();
if (bits & U_ORIGIN2)
to->origin[1] = MSG_ReadCoord();
if (bits & U_ANGLE2)
to->angles[1] = MSG_ReadAngle();
if (bits & U_ORIGIN3)
to->origin[2] = MSG_ReadCoord();
if (bits & U_ANGLE3)
to->angles[2] = MSG_ReadAngle();
if (bits & U_SOLID) {
// FIXME
}
}
示例3: Sky_ReadCameraPosition
void Sky_ReadCameraPosition(void)
{
MathVector3f_t campos;
sky_camera = MSG_ReadByte();
if (!sky_camera)
return;
campos[0] = MSG_ReadCoord();
campos[1] = MSG_ReadCoord();
campos[2] = MSG_ReadCoord();
Math_VectorCopy(campos, sky_camerapos);
}
示例4: Parse_Static
void Parse_Static(void){
MSG_ReadByte();
MSG_ReadByte();
MSG_ReadByte();
MSG_ReadByte();
MSG_ReadCoord();
MSG_ReadAngle();
MSG_ReadCoord();
MSG_ReadAngle();
MSG_ReadCoord();
MSG_ReadAngle();
}
示例5: Parse_Sound
void Parse_Sound(void){
int channel;
channel = MSG_ReadShort();
if (channel & SND_VOLUME)
MSG_ReadByte();
if (channel & SND_ATTENUATION)
MSG_ReadByte();
MSG_ReadByte();
MSG_ReadCoord();
MSG_ReadCoord();
MSG_ReadCoord();
}
示例6: CL_ParticleExplosion
/*
=======================
CL_ParticleExplosion (Hexen II)
=======================
*/
void CL_ParticleExplosion(void)
{
vec3_t org;
short color, radius, counter;
org[0] = MSG_ReadCoord();
org[1] = MSG_ReadCoord();
org[2] = MSG_ReadCoord();
color = MSG_ReadShort();
radius = MSG_ReadShort();
counter = MSG_ReadShort();
R_ColoredParticleExplosion(org,color,radius,counter);
}
示例7: R_ParseExtendedEmitter
void R_ParseExtendedEmitter (void)
{
vec3_t org, vel;
int i, count;
char *name;
ParticleEffect_t *eff;
ParticleEmitter_t *emt;
float lifetime, tick;
//Con_Printf("Particle effect22!!\n");
//origin to spawn on
for (i=0 ; i<3 ; i++)
org[i] = MSG_ReadCoord ();
//velocity to spawn on
for (i=0 ; i<3 ; i++)
vel[i] = MSG_ReadCoord ();
//number of particles to spawn
count = MSG_ReadByte ();
//duration to live
lifetime = MSG_ReadLong () / 100.0;
//animation time
tick = MSG_ReadLong () / 100.0;
//name of effect to spawn
name = MSG_ReadString();
eff = ParticleEffectForName(name);
if (!eff) return;
//allocate it
if (!free_emitters)
return;
emt = free_emitters;
free_emitters = emt->next;
emt->next = active_emitters;
active_emitters = emt;
emt->effect = eff;
VectorCopy(org,emt->origin);
VectorCopy(vel,emt->vel);
emt->die = cl.time+lifetime;
emt->tick = tick;
emt->count = count;
emt->nexttick = 0;
}
示例8: Parse_Spawnbaseline
void Parse_Spawnbaseline(void){
MSG_ReadShort();
MSG_ReadByte();
MSG_ReadByte();
MSG_ReadByte();
MSG_ReadByte();
MSG_ReadCoord();
MSG_ReadAngle();
MSG_ReadCoord();
MSG_ReadAngle();
MSG_ReadCoord();
MSG_ReadAngle();
}
示例9: V_ParseDamage
/*
===============
V_ParseDamage
===============
*/
void
V_ParseDamage(void)
{
int armor, blood;
vec3_t from;
int i;
vec3_t forward, right, up;
const entity_t *ent;
float side;
float count;
armor = MSG_ReadByte();
blood = MSG_ReadByte();
for (i = 0; i < 3; i++)
from[i] = MSG_ReadCoord();
count = blood * 0.5 + armor * 0.5;
if (count < 10)
count = 10;
cl.faceanimtime = cl.time + 0.2; // but sbar face into pain frame
cl.cshifts[CSHIFT_DAMAGE].percent += 3 * count;
if (cl.cshifts[CSHIFT_DAMAGE].percent < 0)
cl.cshifts[CSHIFT_DAMAGE].percent = 0;
if (cl.cshifts[CSHIFT_DAMAGE].percent > 150)
cl.cshifts[CSHIFT_DAMAGE].percent = 150;
if (armor > blood) {
cl.cshifts[CSHIFT_DAMAGE].destcolor[0] = 200;
cl.cshifts[CSHIFT_DAMAGE].destcolor[1] = 100;
cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 100;
} else if (armor) {
cl.cshifts[CSHIFT_DAMAGE].destcolor[0] = 220;
cl.cshifts[CSHIFT_DAMAGE].destcolor[1] = 50;
cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 50;
} else {
cl.cshifts[CSHIFT_DAMAGE].destcolor[0] = 255;
cl.cshifts[CSHIFT_DAMAGE].destcolor[1] = 0;
cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 0;
}
//
// calculate view angle kicks
//
ent = &cl_entities[cl.viewentity];
VectorSubtract(from, ent->origin, from);
VectorNormalize(from);
AngleVectors(ent->angles, forward, right, up);
side = DotProduct(from, right);
v_dmg_roll = count * side * v_kickroll.value;
side = DotProduct(from, forward);
v_dmg_pitch = count * side * v_kickpitch.value;
v_dmg_time = v_kicktime.value;
}
示例10: R_ParseBasicEmitter
/*
===============
R_ParseBasicEmitter
Parse an emitter out of the server message
Basic emitters don't actually spawn an emitter...
===============
*/
void R_ParseBasicEmitter (void)
{
vec3_t org;
int i, count;
char *name;
ParticleEffect_t *eff;
particle_t *p;
//Con_Printf("Particle effect!!\n");
//origin to spawn on
for (i=0 ; i<3 ; i++)
org[i] = MSG_ReadCoord ();
//number of particles to spawn
count = MSG_ReadByte ();
//name of effect to spawn
name = MSG_ReadString();
eff = ParticleEffectForName(name);
if (!eff) return;
for (i=0; i<count; i++) {
p = InitParticleFromEffect(eff,org);
}
}
示例11: R_ParseParticleEffect
/*
===============
R_ParseParticleEffect
Parse an effect out of the server message
===============
*/
void R_ParseParticleEffect(void)
{
vec3_t org, dir;
int i, count, msgcount, color;
for (i=0 ; i<3 ; i++)
{
org[i] = MSG_ReadCoord();
}
for (i=0 ; i<3 ; i++)
{
dir[i] = MSG_ReadChar() * (1.0/16);
}
msgcount = MSG_ReadByte();
color = MSG_ReadByte();
if (msgcount == 255)
{
count = 1024;
}
else
{
count = msgcount;
}
R_RunParticleEffect(org, dir, color, count);
}
示例12: V_ParseDamage
void V_ParseDamage (void)
{
int armor, blood, i;
vec3_t from, forward, right;
float side, count, fraction;
armor = MSG_ReadByte ();
blood = MSG_ReadByte ();
for (i = 0; i < 3; i++)
from[i] = MSG_ReadCoord ();
if (cls.demoseeking)
return;
count = blood * 0.5 + armor * 0.5;
if (count < 10)
count = 10;
cl.faceanimtime = cl.time + 0.2; // put sbar face into pain frame
cl.hurtblur = cl.time + count / 24; // use hurt motion blur.
cl.cshifts[CSHIFT_DAMAGE].percent += 3*count;
if (cl.cshifts[CSHIFT_DAMAGE].percent < 0)
cl.cshifts[CSHIFT_DAMAGE].percent = 0;
if (cl.cshifts[CSHIFT_DAMAGE].percent > 150)
cl.cshifts[CSHIFT_DAMAGE].percent = 150;
fraction = v_damagecshift.value;
if (fraction < 0) fraction = 0;
if (fraction > 1) fraction = 1;
cl.cshifts[CSHIFT_DAMAGE].percent *= fraction;
if (armor > blood) {
cl.cshifts[CSHIFT_DAMAGE].destcolor[0] = 200;
cl.cshifts[CSHIFT_DAMAGE].destcolor[1] = cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 100;
} else if (armor) {
cl.cshifts[CSHIFT_DAMAGE].destcolor[0] = 220;
cl.cshifts[CSHIFT_DAMAGE].destcolor[1] = cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 50;
} else {
cl.cshifts[CSHIFT_DAMAGE].destcolor[0] = 255;
cl.cshifts[CSHIFT_DAMAGE].destcolor[1] = cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 0;
}
// calculate view angle kicks
VectorSubtract (from, cl.simorg, from);
VectorNormalizeFast (from);
AngleVectors (cl.simangles, forward, right, NULL);
side = DotProduct (from, right);
v_dmg_roll = count * side * v_kickroll.value;
side = DotProduct (from, forward);
v_dmg_pitch = count * side * v_kickpitch.value;
v_dmg_time = v_kicktime.value;
}
示例13: CL_ParseBSPDecal
/*
==================
CL_ParseBSPDecal
Spawn decals on map
Crow_bar.
==================
*/
void CL_ParseBSPDecal (void)
{
vec3_t pos;
int decal_size;
char *texname;
texname = MSG_ReadString ();
decal_size = MSG_ReadByte ();
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
if(!texname)
return;
Con_Printf("BSPDECAL[tex: %s size: %i pos: %f %f %f]\n", texname, decal_size, pos[0], pos[1], pos[2]);
R_SpawnDecalBSP(pos, texname, decal_size);
}
示例14: CL_ParseStartSoundPacket
/*
==================
CL_ParseStartSoundPacket
==================
*/
void CL_ParseStartSoundPacket(void)
{
vec3_t pos;
int channel, ent;
int sound_num;
int volume;
int field_mask;
float attenuation;
int i;
field_mask = MSG_ReadByte();
if (field_mask & SND_VOLUME)
volume = MSG_ReadByte ();
else
volume = DEFAULT_SOUND_PACKET_VOLUME;
if (field_mask & SND_ATTENUATION)
attenuation = MSG_ReadByte () / 64.0;
else
attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;
//johnfitz -- PROTOCOL_FITZQUAKE
if (field_mask & SND_LARGEENTITY)
{
ent = (unsigned short) MSG_ReadShort ();
channel = MSG_ReadByte ();
}
else
{
channel = (unsigned short) MSG_ReadShort ();
ent = channel >> 3;
channel &= 7;
}
if (field_mask & SND_LARGESOUND)
sound_num = (unsigned short) MSG_ReadShort ();
else
sound_num = MSG_ReadByte ();
//johnfitz
//johnfitz -- check soundnum
if (sound_num >= MAX_SOUNDS)
Host_Error ("CL_ParseStartSoundPacket: %i > MAX_SOUNDS", sound_num);
//johnfitz
if (ent > cl_max_edicts) //johnfitz -- no more MAX_EDICTS
Host_Error ("CL_ParseStartSoundPacket: ent = %i", ent);
for (i = 0; i < 3; i++)
pos[i] = MSG_ReadCoord ();
S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation);
}
示例15: CL_ParseBeam
/*
=================
CL_ParseBeam
=================
*/
void CL_ParseBeam (const char *modelname, qboolean parse_only)
{
int i, ent, index;
vec3_t start, end;
beam_t *b;
ent = MSG_ReadShort ();
start[0] = MSG_ReadCoord ();
start[1] = MSG_ReadCoord ();
start[2] = MSG_ReadCoord ();
end[0] = MSG_ReadCoord ();
end[1] = MSG_ReadCoord ();
end[2] = MSG_ReadCoord ();
if (parse_only)
return; // JDH: parse message only, don't do anything
if (ent == cl.viewentity)
VectorCopy (end, playerbeam_end); // for cl_truelightning
index = MAX_BEAMS;
for (i = 0, b = cl_beams ; i < MAX_BEAMS ; i++, b++)
{
// override any beam with the same entity
if (b->entity == ent)
{
index = i;
break;
}
// make note of first available slot, but continue checking for same ent:
// if ((index == MAX_BEAMS) && (!b->model || (b->endtime < cl.time)))
if ((index == MAX_BEAMS) && (!b->model || BEAM_INACTIVE(b)))
{
index = i;
}
}
if (index < MAX_BEAMS)
{
b = cl_beams + index;
b->entity = ent;
b->model = Mod_ForName (modelname, true);
b->starttime = cl.time - 0.2; // JDH: for demo rewind (see note in AllocParticle)
b->endtime = cl.time + 0.2;
VectorCopy (start, b->start);
VectorCopy (end, b->end);
#ifdef _DEBUG
// if (cls.demoplayback && !cl_demorewind.value)
// CL_PushBeam (b);
#endif
return;
}
Con_Print ("beam list overflow!\n");
}