void CLensFlare::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { MESSAGE_BEGIN( MSG_ALL, gmsgLensFlare, pev->origin ); WRITE_ANGLE( pev->angles.x ); WRITE_ANGLE( pev->angles.y ); MESSAGE_END(); }
void CSuperStendXmlLoader::packet_1002(const unsigned real_sequence, const unsigned sequence, const QMap<QString, QVariant> content) { #define ANGLE_TRANSLATE(from_angle, to_angle, coef)\ to_angle = coef * content[from_angle].toDouble() / M_PI * 180; // to_angle += 0.01 * content[from_angle].toDouble(); // / M_PI * 180; ANGLE_TRANSLATE("accelerometer_X", pitch, 1); ANGLE_TRANSLATE("accelerometer_Y", roll, -1); ANGLE_TRANSLATE("accelerometer_Z", course, 1); stream.writeStartElement("frame"); stream.writeAttribute("id", QString::number(pc)); #define WRITE_ELEM(elem, type, value)\ stream.writeStartElement(elem);\ stream.writeAttribute("type", type);\ stream.writeCharacters(value);\ stream.writeEndElement(); #define WRITE_ANGLE(elem, value)\ WRITE_ELEM(elem, "double", QString::number(value / M_PI * 180, 'g', 11)); WRITE_ANGLE("x", content["latitude"].toDouble()); WRITE_ANGLE("y", content["longitude"].toDouble()); WRITE_ELEM("h", "double", QString::number(content["altitude"].toDouble(), 'g', 3)); WRITE_ANGLE("course", course); WRITE_ANGLE("roll", roll); WRITE_ANGLE("pitch", pitch); WRITE_ELEM("aspect_x", "double", QString::number(44.9, 'g', 3)); WRITE_ELEM("aspect_y", "double", QString::number(26.6, 'g', 3)); WRITE_ELEM("coord_system", "unsigned", QString::number(2)); stream.writeEndElement(); pc++; // printf_TODO("Пакетов %u - секунды %lf - курс: %lf %lf, крен: %lf %lf, тангаж: %lf %lf\n", // pc, pc * 0.01, // course, content["gyroscope_Z"].toDouble(), // roll, content["gyroscope_X"].toDouble(), // pitch, content["gyroscope_Y"].toDouble()); printf("%.11lf\n", content["gyroscope_Z"].toDouble()); }
// // EjectBrass - tosses a brass shell from passed origin at passed velocity // void EjectBrass ( const Vector &vecOrigin, const Vector &vecVelocity, float rotation, int model, int soundtype ) { // FIX: when the player shoots, their gun isn't in the same position as it is on the model other players see. MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecOrigin ); WRITE_BYTE( TE_MODEL); WRITE_COORD( vecOrigin.x); WRITE_COORD( vecOrigin.y); WRITE_COORD( vecOrigin.z); WRITE_COORD( vecVelocity.x); WRITE_COORD( vecVelocity.y); WRITE_COORD( vecVelocity.z); WRITE_ANGLE( rotation ); WRITE_SHORT( model ); WRITE_BYTE ( soundtype); WRITE_BYTE ( 25 );// 2.5 seconds MESSAGE_END(); }
void Message::Send() { msgparam *pParam = NULL; for (size_t i=1; i<=m_CurParam; i++) { pParam = m_Params[i]; switch (pParam->type) { case arg_byte: WRITE_BYTE(pParam->v.iData); break; case arg_char: WRITE_CHAR(pParam->v.iData); break; case arg_short: WRITE_SHORT(pParam->v.iData); break; case arg_long: WRITE_LONG(pParam->v.iData); break; case arg_angle: WRITE_ANGLE(pParam->v.fData); break; case arg_coord: WRITE_COORD(pParam->v.fData); break; case arg_string: WRITE_STRING(pParam->szData.chars()); break; case arg_entity: WRITE_ENTITY(pParam->v.iData); break; } } }
static cell AMX_NATIVE_CALL write_angle_f(AMX *amx, cell *params) /* 1 param */ { WRITE_ANGLE(amx_ctof(params[1])); return 1; }
static cell AMX_NATIVE_CALL write_angle(AMX *amx, cell *params) /* 1 param */ { WRITE_ANGLE(static_cast<float>(params[1])); return 1; }