}
if(f & 2)
{
- WriteCoord(MSG_ENTITY, this.angles.x);
- WriteCoord(MSG_ENTITY, this.angles.y);
- WriteCoord(MSG_ENTITY, this.angles.z);
+ WriteAngleVector(MSG_ENTITY, this.angles);
}
if(f & 4)
{
- WriteCoord(MSG_ENTITY, this.avelocity.x);
- WriteCoord(MSG_ENTITY, this.avelocity.y);
- WriteCoord(MSG_ENTITY, this.avelocity.z);
+ WriteAngleVector(MSG_ENTITY, this.avelocity);
}
WriteShort(MSG_ENTITY, this.scale * 256.0);
WriteShort(MSG_ENTITY, this.scale2 * 256.0);
}
if(f & 2)
{
- e.angles_x = ReadAngle();
- e.angles_y = ReadAngle();
- e.angles_z = ReadAngle();
+ e.angles = ReadAngleVector();
}
if(f & 4)
{
- e.avelocity_x = ReadAngle();
- e.avelocity_y = ReadAngle();
- e.avelocity_z = ReadAngle();
+ e.avelocity = ReadAngleVector();
}
e.scale1 = ReadShort() / 256.0;
e.scale2 = ReadShort() / 256.0;
this.origin = ReadVector();
setorigin(this, this.origin);
- this.angles_x = ReadAngle();
- this.angles_y = ReadAngle();
- this.angles_z = ReadAngle();
+ this.angles = ReadAngleVector();
this.drawmask = MASK_NORMAL;
setmodel(this, MDL_Null); // give it a size for clientcamera
WriteVector(MSG_ENTITY, this.origin);
- WriteAngle(MSG_ENTITY, this.angles_x);
- WriteAngle(MSG_ENTITY, this.angles_y);
- WriteAngle(MSG_ENTITY, this.angles_z);
+ WriteAngleVector(MSG_ENTITY, this.angles);
return true;
}
FOREACH_CLIENT(true, it.clientcamera = cam;);
+ // NOTE: engine networked
WriteByte(MSG_ALL, SVC_SETVIEWANGLES);
WriteAngle(MSG_ALL, cam.angles_x);
WriteAngle(MSG_ALL, cam.angles_y);
WriteVector(MSG_ENTITY, this.size);
- WriteAngle(MSG_ENTITY, this.mangle_x);
- WriteAngle(MSG_ENTITY, this.mangle_y);
- WriteAngle(MSG_ENTITY, this.mangle_z);
+ WriteAngleVector(MSG_ENTITY, this.mangle);
WriteShort(MSG_ENTITY, this.speed);
WriteShort(MSG_ENTITY, this.height);
this.size = ReadVector();
- this.mangle_x = ReadAngle();
- this.mangle_y = ReadAngle();
- this.mangle_z = ReadAngle();
+ this.mangle = ReadAngleVector();
this.speed = ReadShort();
this.height = ReadShort();
WriteVector(MSG_ENTITY, this.view_ofs);
- WriteAngle(MSG_ENTITY, this.mangle_x);
- WriteAngle(MSG_ENTITY, this.mangle_y);
- WriteAngle(MSG_ENTITY, this.mangle_z);
+ WriteAngleVector(MSG_ENTITY, this.mangle);
WriteShort(MSG_ENTITY, this.speed);
WriteShort(MSG_ENTITY, this.height);
this.view_ofs = ReadVector();
- this.mangle_x = ReadAngle();
- this.mangle_y = ReadAngle();
- this.mangle_z = ReadAngle();
+ this.mangle = ReadAngleVector();
this.speed = ReadShort();
this.height = ReadShort();
}
else
{
- WriteAngle(MSG_ENTITY, this.mangle_x);
- WriteAngle(MSG_ENTITY, this.mangle_y);
+ WriteAngleVector2D(MSG_ENTITY, this.mangle);
}
}
if(sendflags & SF_LASER_UPDATE_ACTIVE)
}
else
{
- this.angles_x = ReadAngle();
- this.angles_y = ReadAngle();
+ this.angles = ReadAngleVector2D();
}
}
if(sendflags & SF_LASER_UPDATE_ACTIVE)
WriteCoord(MSG_ENTITY, this.speed);
WriteString(MSG_ENTITY, this.targetname);
WriteVector(MSG_ENTITY, this.origin);
-
- WriteAngle(MSG_ENTITY, this.mangle_x);
- WriteAngle(MSG_ENTITY, this.mangle_y);
- WriteAngle(MSG_ENTITY, this.mangle_z);
+ WriteAngleVector(MSG_ENTITY, this.mangle);
}
return true;
this.speed = ReadCoord();
this.targetname = strzone(ReadString());
this.origin = ReadVector();
-
- this.mangle_x = ReadAngle();
- this.mangle_y = ReadAngle();
- this.mangle_z = ReadAngle();
+ this.mangle = ReadAngleVector();
setorigin(this, this.origin);
if(sf & BIT(2))
{
if(sf & 0x10)
- {
- WriteAngle(MSG_ENTITY, this.angles.x);
- WriteAngle(MSG_ENTITY, this.angles.y);
- WriteAngle(MSG_ENTITY, this.angles.z);
- }
+ WriteAngleVector(MSG_ENTITY, this.angles);
}
if(sf & BIT(3))
if(f & 4)
{
if(f & 0x10)
- {
- this.angles_x = ReadAngle();
- this.angles_y = ReadAngle();
- this.angles_z = ReadAngle();
- }
+ this.angles = ReadAngleVector();
else
this.angles = '0 0 0';
}
WriteString(MSG_ENTITY, this.targetname);
WriteVector(MSG_ENTITY, this.origin);
- WriteAngle(MSG_ENTITY, this.angles_x);
- WriteAngle(MSG_ENTITY, this.angles_y);
- WriteAngle(MSG_ENTITY, this.angles_z);
+ WriteAngleVector(MSG_ENTITY, this.angles);
return true;
}
this.targetname = strzone(ReadString());
this.origin = ReadVector();
- this.angles_x = ReadAngle();
- this.angles_y = ReadAngle();
- this.angles_z = ReadAngle();
+ this.angles = ReadAngleVector();
return = true;
WriteVector(MSG_ENTITY, this.origin);
- WriteAngle(MSG_ENTITY, this.angles_x);
- WriteAngle(MSG_ENTITY, this.angles_y);
- WriteAngle(MSG_ENTITY, this.angles_z);
+ WriteAngleVector(MSG_ENTITY, this.angles);
return true;
}
this.origin = ReadVector();
setorigin(this, this.origin);
- this.movedir_x = ReadAngle();
- this.movedir_y = ReadAngle();
- this.movedir_z = ReadAngle();
+ this.movedir = ReadAngleVector();
return = true;
if(sf & ISF_ANGLES)
{
- this.angles_x = ReadAngle();
- this.angles_y = ReadAngle();
- this.angles_z = ReadAngle();
+ this.angles = ReadAngleVector();
}
if(sf & ISF_SIZE)
if(sf & ISF_ANGLES)
{
- WriteAngle(MSG_ENTITY, this.angles_x);
- WriteAngle(MSG_ENTITY, this.angles_y);
- WriteAngle(MSG_ENTITY, this.angles_z);
+ WriteAngleVector(MSG_ENTITY, this.angles);
}
// sets size on the client, unused on server
this.origin = ReadVector();
setorigin(this, this.origin);
- this.angles_x = ReadAngle();
- this.angles_y = ReadAngle();
+ this.angles = ReadAngleVector2D();
turret_construct(this, isnew);
this.colormap = 1024;
bool turret_send(entity this, entity to, float sf)
{
-
WriteHeader(MSG_ENTITY, ENT_CLIENT_TURRET);
WriteByte(MSG_ENTITY, sf);
if(sf & TNSF_SETUP)
WriteVector(MSG_ENTITY, this.origin);
- WriteAngle(MSG_ENTITY, this.angles_x);
- WriteAngle(MSG_ENTITY, this.angles_y);
+ WriteAngleVector2D(MSG_ENTITY, this.angles);
}
if(sf & TNSF_ANG)
WriteByte (MSG_ONE, SVC_SETVIEWPORT);
WriteEntity( MSG_ONE, player);
+ // NOTE: engine networked
WriteByte (MSG_ONE, SVC_SETVIEWANGLES);
WriteAngle(MSG_ONE, 0);
WriteAngle(MSG_ONE, vehic.angles_y);
WriteByte (MSG_ONE, SVC_SETVIEWPORT);
WriteEntity(MSG_ONE, veh.vehicle_viewport);
+ // NOTE: engine networked
WriteByte (MSG_ONE, SVC_SETVIEWANGLES);
if(veh.tur_head)
{
WriteByte(MSG_ONE, SVC_SETVIEWPORT);
WriteEntity(MSG_ONE, player);
+ // NOTE: engine networked
WriteByte(MSG_ONE, SVC_SETVIEWANGLES);
WriteAngle(MSG_ONE, 0);
WriteAngle(MSG_ONE, vehic.angles.y);
WriteByte(MSG_ONE, SVC_SETVIEWPORT);
WriteEntity(MSG_ONE, gunner.vehicle_viewport);
+ // NOTE: engine networked
WriteByte(MSG_ONE, SVC_SETVIEWANGLES);
WriteAngle(MSG_ONE, gunner.angles_x + vehic.angles_x); // tilt
WriteAngle(MSG_ONE, gunner.angles_y + vehic.angles_y); // yaw
}
if(sf & ARC_SF_BEAMDIR) // beam direction
{
- WriteAngle(MSG_ENTITY, this.beam_dir.x);
- WriteAngle(MSG_ENTITY, this.beam_dir.y);
- WriteAngle(MSG_ENTITY, this.beam_dir.z);
+ WriteAngleVector(MSG_ENTITY, this.beam_dir);
}
if(sf & ARC_SF_BEAMTYPE) // beam type
{
if(sf & ARC_SF_BEAMDIR) // beam direction
{
- this.angles_x = ReadAngle();
- this.angles_y = ReadAngle();
- this.angles_z = ReadAngle();
+ this.angles = ReadAngleVector();
}
if(sf & ARC_SF_BEAMTYPE) // beam type
\
PROP(false, porto_v_angle_held, WEPENT_SET_NORMAL, \
{ WriteByte(chan, this.porto_v_angle_held); if(this.porto_v_angle_held) { \
- WriteAngle(chan, this.owner.porto_v_angle.x); WriteAngle(chan, this.owner.porto_v_angle.y); \
+ WriteAngleVector2D(chan, this.owner.porto_v_angle); \
} }, \
{ (viewmodels[this.m_wepent_slot]).angles_held_status = ReadByte(); if((viewmodels[this.m_wepent_slot]).angles_held_status) { \
- (viewmodels[this.m_wepent_slot]).angles_held = vec2(ReadAngle(), ReadAngle()); } \
+ (viewmodels[this.m_wepent_slot]).angles_held = ReadAngleVector2D(); } \
else { (viewmodels[this.m_wepent_slot]).angles_held = '0 0 0'; } }) \
\
PROP(false, tuba_instrument, WEPENT_SET_NORMAL, \
#define ReadFloat() ReadCoord()
#define ReadVector() vec3(ReadFloat(), ReadFloat(), ReadFloat())
#define ReadVector2D() vec2(ReadFloat(), ReadFloat())
+ #define ReadAngleVector() vec3(ReadAngle(), ReadAngle(), ReadAngle())
+ #define ReadAngleVector2D() vec2(ReadAngle(), ReadAngle())
int Readbits(int num)
{
#define WriteFloat(to, f) WriteCoord(to, f)
#define WriteVector(to, v) MACRO_BEGIN WriteFloat(to, v.x); WriteFloat(to, v.y); WriteFloat(to, v.z); MACRO_END
#define WriteVector2D(to, v) MACRO_BEGIN WriteFloat(to, v.x); WriteFloat(to, v.y); MACRO_END
+ #define WriteAngleVector(to, v) MACRO_BEGIN WriteAngle(to, v.x); WriteAngle(to, v.y); WriteAngle(to, v.z); MACRO_END
+ #define WriteAngleVector2D(to, v) MACRO_BEGIN WriteAngle(to, v.x); WriteAngle(to, v.y); MACRO_END
void Writebits(float dst, float val, int num)
{