当前位置: 首页>>代码示例>>C++>>正文


C++ SetFloatValue函数代码示例

本文整理汇总了C++中SetFloatValue函数的典型用法代码示例。如果您正苦于以下问题:C++ SetFloatValue函数的具体用法?C++ SetFloatValue怎么用?C++ SetFloatValue使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SetFloatValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SetState

Animation::Animation()
{
	SetState(true);
	SetType(OBJ_TYPE_ANIMATION);
	SetPosition(Point2D(512, 512));
	sprite = NULL;
	source = NULL;

	color = White;

	AllocateUInt32Values(ANIM_UINT32_VARS);
	AllocateFloatValues(ANIM_FLOAT_VARS);

	SetFloatValue(ANIM_VAR_BASE_SCALE, 1.0);
}
开发者ID:Dingf,项目名称:Paper-TD,代码行数:15,代码来源:animation.cpp

示例2: float

void Player::UpdateAllRunesRegen()
{
    for (uint8 i = 0; i < NUM_RUNE_TYPES; ++i)
    {
        if (uint32 cooldown = GetRuneTypeBaseCooldown(RuneType(i)))
        {
            float regen = float(1 * IN_MILLISECONDS) / float(cooldown);

            if (regen < 0.0099999998f)
                regen = 0.01f;

            SetFloatValue(PLAYER_RUNE_REGEN_1 + i, regen);
        }
    }
}
开发者ID:AlucardVoss,项目名称:Patchs,代码行数:15,代码来源:StatSystem.cpp

示例3: SetFloatValue

void Player::UpdateSpellCritChance(uint32 school)
{
    // For normal school set zero crit chance
    if (school == SPELL_SCHOOL_NORMAL)
    {
        SetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1, 0.0f);
        return;
    }
    // For others recalculate it from:
    float crit = 0.0f;
    // Crit from Intellect
    crit += GetSpellCritFromIntellect();
    // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE
    crit += GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
    // Increase crit from SPELL_AURA_MOD_CRIT_PCT
    crit += GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
    // Increase crit by school from SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
    crit += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, 1<<school);
    // Increase crit from spell crit ratings
    crit += GetRatingBonusValue(CR_CRIT_SPELL);

    // Store crit value
    SetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + school, crit);
}
开发者ID:redlaine,项目名称:InfinityCore-Ark,代码行数:24,代码来源:StatSystem.cpp

示例4: Relocate

bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x,
		float y, float z, float ang, uint32 animprogress, uint32 dynflags) {
	Relocate(x, y, z, ang);
	// instance id and phaseMask isn't set to values different from std.

	if (!IsPositionValid()) {
		sLog->outError(
				"Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
				guidlow, x, y);
		return false;
	}

	Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT);

	GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(entry);

	if (!goinfo) {
		sLog->outErrorDb(
				"Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u  (X: %f Y: %f Z: %f) ang: %f",
				guidlow, mapid, x, y, z, ang);
		return false;
	}

	m_goInfo = goinfo;

	SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size);

	SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
	//SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
	SetUInt32Value(GAMEOBJECT_FLAGS, MAKE_PAIR32(0x28, 0x64));
	SetUInt32Value(GAMEOBJECT_LEVEL, m_period);
	SetEntry(goinfo->id);

	SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId);

	SetGoState(GO_STATE_READY);
	SetGoType(GameobjectTypes(goinfo->type));

	SetGoAnimProgress(animprogress);
	if (dynflags)
		SetUInt32Value(GAMEOBJECT_DYNAMIC, MAKE_PAIR32(0, dynflags));

	SetName(goinfo->name);

	SetZoneScript();

	return true;
}
开发者ID:FrenchCORE,项目名称:Server,代码行数:48,代码来源:Transport.cpp

示例5: SetMap

bool DynamicObject::CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caster, SpellInfo const* spell, Position const& pos, float radius, DynamicObjectType type, uint32 spellXSpellVisualId)
{
    _spellXSpellVisualId = spellXSpellVisualId;
    SetMap(caster->GetMap());
    Relocate(pos);
    if (!IsPositionValid())
    {
        TC_LOG_ERROR("misc", "DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spell->Id, GetPositionX(), GetPositionY());
        return false;
    }

    WorldObject::_Create(ObjectGuid::Create<HighGuid::DynamicObject>(GetMapId(), spell->Id, guidlow));
    SetPhaseMask(caster->GetPhaseMask(), false);

    SetEntry(spell->Id);
    SetObjectScale(1.0f);
    SetGuidValue(DYNAMICOBJECT_CASTER, caster->GetGUID());
    SetUInt32Value(DYNAMICOBJECT_TYPE, type);
    SetUInt32Value(DYNAMICOBJECT_SPELL_X_SPELL_VISUAL_ID, spellXSpellVisualId);
    SetUInt32Value(DYNAMICOBJECT_SPELLID, spell->Id);
    SetFloatValue(DYNAMICOBJECT_RADIUS, radius);
    SetUInt32Value(DYNAMICOBJECT_CASTTIME, getMSTime());

    if (IsWorldObject())
        setActive(true);    //must before add to map to be put in world container

    Transport* transport = caster->GetTransport();
    if (transport)
    {
        float x, y, z, o;
        pos.GetPosition(x, y, z, o);
        transport->CalculatePassengerOffset(x, y, z, &o);
        m_movementInfo.transport.pos.Relocate(x, y, z, o);

        // This object must be added to transport before adding to map for the client to properly display it
        transport->AddPassenger(this);
    }

    if (!GetMap()->AddToMap(this))
    {
        // Returning false will cause the object to be deleted - remove from transport
        if (transport)
            transport->RemovePassenger(this);
        return false;
    }

    return true;
}
开发者ID:Lyill,项目名称:TrinityCore,代码行数:48,代码来源:DynamicObject.cpp

示例6: GetSpellCritFromIntellect

void Player::UpdateSpellCritChance(uint32 school)
{
    float crit = 0.0f;
    // Base spell crit and spell crit from Intellect
    crit += GetSpellCritFromIntellect();
    // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE
    crit += GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
    // Increase crit by school from SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
    crit += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, (1 << school));
    // Increase crit from spell crit ratings
    crit += GetRatingBonusValue(CR_CRIT_SPELL);
    // Set current crit chance
    m_modSpellCritChance[school] = crit;
    // Set UI display value:
    SetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + school, std::max(0.0f, std::min(crit, 100.0f)));
}
开发者ID:MantisLord,项目名称:mangos-tbc,代码行数:16,代码来源:StatSystem.cpp

示例7: Item

Container::Container(uint32 high,uint32 low) : Item()
{
	m_objectTypeId = TYPEID_CONTAINER;
	internal_object_type = INTERNAL_OBJECT_TYPE_CONTAINER;
	m_valuesCount = CONTAINER_END;
	m_uint32Values = __fields;
	memset(m_uint32Values, 0,(CONTAINER_END)*sizeof(uint32));
	m_updateMask.SetCount(CONTAINER_END);
	SetUInt32Value( OBJECT_FIELD_TYPE,TYPE_CONTAINER|TYPE_ITEM|TYPE_OBJECT);
	SetUInt32Value( OBJECT_FIELD_GUID,low);
	SetUInt32Value( OBJECT_FIELD_GUID+1,high);
	m_wowGuid.Init(GetGUID());

	SetFloatValue( OBJECT_FIELD_SCALE_X, 1 );//always 1

	random_suffix=random_prop=0;
}
开发者ID:AwkwardDev,项目名称:Descent-core-scripts-3.3.5,代码行数:17,代码来源:Container.cpp

示例8: Relocate

bool DynamicObject::Create(uint32 guidlow, Unit* caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius, DynamicObjectType type)
{
    WorldObject::_Create(ObjectGuid(HIGHGUID_DYNAMICOBJECT, guidlow), caster->GetPhaseMask());

    Relocate(WorldLocation(caster->GetMapId(), x, y, z, 0.0f, caster->GetPhaseMask(), caster->GetInstanceId()));
    SetMap(caster->GetMap());

    if (!IsPositionValid())
    {
        sLog.outError("DynamicObject (spell %u eff %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spellId, effIndex, GetPositionX(), GetPositionY());
        return false;
    }

    SpellEntry const* spellProto = sSpellStore.LookupEntry(spellId);
    if (!spellProto)
    {
        sLog.outError("DynamicObject (spell %u) not created. Spell not exist!", spellId);
        return false;
    }

    SetEntry(spellId);
    SetObjectScale(DEFAULT_OBJECT_SCALE);

    if (type == DYNAMIC_OBJECT_RAID_MARKER)
    {
        MANGOS_ASSERT(caster->GetTypeId() == TYPEID_PLAYER && ((Player*)caster)->GetGroup()
            && "DYNAMIC_OBJECT_RAID_MARKER must only be casted by players and that are in group.");
        SetGuidValue(DYNAMICOBJECT_CASTER, ((Player*)caster)->GetGroup()->GetObjectGuid());
    }
    else
        SetGuidValue(DYNAMICOBJECT_CASTER, caster->GetObjectGuid());

    SetUInt32Value(DYNAMICOBJECT_BYTES, spellProto->GetSpellVisual() | (type << 28));

    SetUInt32Value(DYNAMICOBJECT_SPELLID, spellId);
    SetFloatValue(DYNAMICOBJECT_RADIUS, radius);
    SetUInt32Value(DYNAMICOBJECT_CASTTIME, WorldTimer::getMSTime());    // new 2.4.0

    m_aliveDuration = duration;
    m_radius = radius;
    m_effIndex = effIndex;
    m_spellId = spellId;
    m_positive = IsPositiveEffect(spellProto, m_effIndex);

    return true;
}
开发者ID:Jojo2323,项目名称:mangos3,代码行数:46,代码来源:DynamicObject.cpp

示例9: SetMapId

bool Vehicle::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 vehicleId, uint32 team, const CreatureData *data)
{
    SetMapId(map->GetId());
    SetInstanceId(map->GetInstanceId());
    SetPhaseMask(phaseMask,false);

    CreatureInfo const *cinfo = objmgr.GetCreatureTemplate(Entry);
    if(!cinfo)
    {
        sLog.outErrorDb("Creature entry %u does not exist.", Entry);
        return false;
    }

    Object::_Create(guidlow, Entry, HIGHGUID_VEHICLE);

    if(!UpdateEntry(Entry, team, data))
        return false;

    if(!vehicleId)
    {
        CreatureDataAddon const *cainfo = GetCreatureAddon();
        if(!cainfo)
            return false;
        vehicleId = cainfo->vehicle_id;
    }
    if(!SetVehicleId(vehicleId))
        return false;

    LoadCreaturesAddon();

    m_regenHealth = false;
    m_creation_time = getMSTime();

    SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f);
    //RemoveMonsterMoveFlag(MONSTER_MOVE_WALK);

    //Notify the map's instance data.
    //Only works if you create the object in it, not if it is moves to that map.
    //Normally non-players do not teleport to other maps.
    if(map->IsDungeon() && ((InstanceMap*)map)->GetInstanceData())
    {
        ((InstanceMap*)map)->GetInstanceData()->OnCreatureCreate(this);
    }

    return true;
}
开发者ID:Trizzor,项目名称:uecore,代码行数:46,代码来源:Vehicle.cpp

示例10: switch

void CGUISliderControl::SetFromPosition(const CPoint &point, bool guessSelector /* = false */)
{

  float fPercent;
  if (m_orientation == HORIZONTAL)
    fPercent = (point.x - m_guiBackground.GetXPosition()) / m_guiBackground.GetWidth();
  else
    fPercent = (m_guiBackground.GetYPosition() + m_guiBackground.GetHeight() - point.y) / m_guiBackground.GetHeight();

  if (fPercent < 0) fPercent = 0;
  if (fPercent > 1) fPercent = 1;

  if (m_rangeSelection && guessSelector)
  {
    // choose selector which value is closer to value calculated from position
    if (fabs(GetPercentage(RangeSelectorLower) - 100 * fPercent) <= fabs(GetPercentage(RangeSelectorUpper) - 100 * fPercent))
      m_currentSelector = RangeSelectorLower;
    else
      m_currentSelector = RangeSelectorUpper;
  }

  switch (m_iType)
  {
  case SLIDER_CONTROL_TYPE_FLOAT:
    {
      float fValue = m_fStart + (m_fEnd - m_fStart) * fPercent;
      SetFloatValue(fValue, m_currentSelector, true);
      break;
    }

  case SLIDER_CONTROL_TYPE_INT:
    {
      int iValue = (int)(m_iStart + (float)(m_iEnd - m_iStart) * fPercent + 0.49f);
      SetIntValue(iValue, m_currentSelector, true);
      break;
    }

  case SLIDER_CONTROL_TYPE_PERCENTAGE:
  default:
    {
      SetPercentage(fPercent * 100, m_currentSelector, true);
      break;
    }
  }
  SendClick();
}
开发者ID:FLyrfors,项目名称:xbmc,代码行数:46,代码来源:GUISliderControl.cpp

示例11: Relocate

bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress, uint32 dynflags)
{
    Relocate(x,y,z,ang);

    SetMapId(mapid);

    if (!IsPositionValid())
    {
        sLog.outLog(LOG_DEFAULT, "ERROR: Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
            guidlow,x,y);
        return false;
    }

    Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT);

    GameObjectInfo const* goinfo = ObjectMgr::GetGameObjectInfo(guidlow);

    if (!goinfo)
    {
        sLog.outLog(LOG_DB_ERR, "Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u  (X: %f Y: %f Z: %f) ang: %f",guidlow, mapid, x, y, z, ang);
        return false;
    }

    m_goInfo = goinfo;

    SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size);

    SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
    SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);

    SetUInt32Value(OBJECT_FIELD_ENTRY, goinfo->id);

    SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId);

    SetGoState(GO_STATE_READY);
    SetGoType(GameobjectTypes(goinfo->type));

    SetGoAnimProgress(animprogress);

    if (dynflags)
        SetUInt32Value(GAMEOBJECT_DYN_FLAGS, dynflags);

    SetName(goinfo->name);

    return true;
}
开发者ID:Blumfield,项目名称:ptc2,代码行数:46,代码来源:Transports.cpp

示例12: GetAura

void Player::UpdateMastery()
{
    if (HasAuraType(SPELL_AURA_MASTERY))
    {
        if(HasAura(76671))
            GetAura(76671)->RecalculateAmountOfEffects();//Paladin Protection Mastery
        if(HasAura(77514))
            GetAura(77514)->RecalculateAmountOfEffects();//DK Frost Mastery
        if(HasAura(48517))
            GetAura(48517)->RecalculateAmountOfEffects();// Druid Balance Mastery
        if(HasAura(48518))
            GetAura(48518)->RecalculateAmountOfEffects();// Druid Balance Mastery
        if(HasAura(76857))
            GetAura(76857)->RecalculateAmountOfEffects();// Warrior Protection Mastery
        SetInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + CR_MASTERY, m_baseRatingValue[CR_MASTERY]);
        SetFloatValue(PLAYER_MASTERY, GetMasteryPoints());
    }
}
开发者ID:Jildor,项目名称:4.3.4-Core,代码行数:18,代码来源:StatSystem.cpp

示例13: memset

Corpse::Corpse(uint32 high, uint32 low)
{
	m_objectTypeId = TYPEID_CORPSE;
	m_valuesCount = CORPSE_END;
	m_uint32Values = _fields;
	memset(m_uint32Values, 0,(CORPSE_END)*sizeof(uint32));
	m_updateMask.SetCount(CORPSE_END);
	SetUInt32Value( OBJECT_FIELD_TYPE,TYPE_CORPSE|TYPE_OBJECT);
	SetUInt32Value( OBJECT_FIELD_GUID,low);
	SetUInt32Value( OBJECT_FIELD_GUID+1,high);
	m_wowGuid.Init(GetGUID());

	SetFloatValue( OBJECT_FIELD_SCALE_X, 1 );//always 1
	  

	m_state = CORPSE_STATE_BODY;
	_loadedfromdb = false;
}
开发者ID:Refuge89,项目名称:Arc_Mind,代码行数:18,代码来源:Corpse.cpp

示例14: Relocate

bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress, uint32 dynflags)
{
    Relocate(x,y,z,ang);

    SetMapId(mapid);

    if(!IsPositionValid())
    {
        sLog.outError("ERROR: Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
            guidlow,x,y);
        return false;
    }

    Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT);

    GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(guidlow);

    if (!goinfo)
    {
        sLog.outErrorDb("Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u  (X: %f Y: %f Z: %f) ang: %f",guidlow, mapid, x, y, z, ang);
        return false;
    }

    m_goInfo = goinfo;

    SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size);

    SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
    //SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
    SetUInt32Value(GAMEOBJECT_FLAGS, MAKE_PAIR32(0x28, 0x64));
    SetUInt32Value(GAMEOBJECT_LEVEL, m_period);
    SetEntry(goinfo->id);

    SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId);

    SetGoState(1);
    SetGoType(GameobjectTypes(goinfo->type));

    SetGoAnimProgress(animprogress);
    if(dynflags)
        SetUInt32Value(GAMEOBJECT_DYNAMIC, MAKE_PAIR32(0, dynflags));

    return true;
}
开发者ID:Ledeet,项目名称:mangos,代码行数:44,代码来源:Transports.cpp

示例15: SetUInt32Value

void Item::Create( uint32 guidlow, uint32 itemid, Player *owner )
{
    Object::_Create( guidlow, HIGHGUID_ITEM );

    SetUInt32Value( OBJECT_FIELD_ENTRY, itemid );
    SetFloatValue( OBJECT_FIELD_SCALE_X, 1.0f );

    SetUInt64Value( ITEM_FIELD_OWNER, owner->GetGUID() );
    SetUInt64Value( ITEM_FIELD_CONTAINED, owner->GetGUID() );
    SetUInt32Value( ITEM_FIELD_STACK_COUNT, 1 );

    m_itemProto = objmgr.GetItemPrototype( itemid );
    ASSERT(m_itemProto);

    //for(int i=5;i<m_valuesCount;i++)
    //     SetUInt32Value( i, 1 );

    SetUInt32Value( ITEM_FIELD_MAXDURABILITY, m_itemProto->MaxDurability);
    SetUInt32Value( ITEM_FIELD_DURABILITY, m_itemProto->MaxDurability);
/*
    ITEM_FIELD_OWNER                        =    6,  //  2  UINT64
    ITEM_FIELD_CONTAINED                    =    8,  //  2  UINT64
    ITEM_FIELD_CREATOR                      =   10,  //  2  UINT64
    ITEM_FIELD_GIFTCREATOR                  =   12,  //  2  UINT64
    ITEM_FIELD_STACK_COUNT                  =   14,  //  1  UINT32
    ITEM_FIELD_DURATION                     =   15,  //  1  UINT32
    ITEM_FIELD_SPELL_CHARGES                =   16,  //  5  SPELLCHARGES
    ITEM_FIELD_FLAGS                        =   21,  //  1  UINT32
    ITEM_FIELD_ENCHANTMENT                  =   22,  //  21 ENCHANTMENT
    ITEM_FIELD_PROPERTY_SEED                =   43,  //  1  UINT32
    ITEM_FIELD_RANDOM_PROPERTIES_ID         =   44,  //  1  UINT32
    ITEM_FIELD_ITEM_TEXT_ID                 =   45,  //  1  UINT32
    ITEM_FIELD_DURABILITY                   =   46,  //  1  UINT32
    ITEM_FIELD_MAXDURABILITY                =   47,  //  1  UINT32
*/
    SetUInt32Value( ITEM_FIELD_SPELL_CHARGES, m_itemProto->SpellCharges[0]);
    SetUInt32Value( ITEM_FIELD_SPELL_CHARGES+1, m_itemProto->SpellCharges[1]);
    SetUInt32Value( ITEM_FIELD_SPELL_CHARGES+2, m_itemProto->SpellCharges[2]);
    SetUInt32Value( ITEM_FIELD_SPELL_CHARGES+3, m_itemProto->SpellCharges[3]);
    SetUInt32Value( ITEM_FIELD_SPELL_CHARGES+4, m_itemProto->SpellCharges[4]);
    SetUInt32Value( ITEM_FIELD_FLAGS, m_itemProto->Flags);
    SetUInt32Value( ITEM_FIELD_ITEM_TEXT_ID, m_itemProto->DisplayInfoID);
    m_owner = owner;
}
开发者ID:Artea,项目名称:mangos-svn,代码行数:44,代码来源:Item.cpp


注:本文中的SetFloatValue函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。