Пример #1
0
bool CalAnimationAction::update(float deltaTime)
{
  // update animation action time

  if(getState() != STATE_STOPPED)
  {
    setTime(getTime() + deltaTime * getTimeFactor());
  }

  // handle IN phase
  if(getState() == STATE_IN)
  {
    // check if we are still in the IN phase
    if(getTime() < m_delayIn)
    {
      setWeight(getTime() / m_delayIn * m_weightTarget);
      //m_weight = m_time / m_delayIn;
    }
    else
    {
      setState(STATE_STEADY);
      setWeight(m_weightTarget);
    }
  }

  // handle STEADY
  if(getState() == STATE_STEADY)
  {
    // check if we reached OUT phase
    if(!m_autoLock && getTime() >= getCoreAnimation()->getDuration() - m_delayOut)
    {
      setState(STATE_OUT);
    }
    // if the anim is supposed to stay locked on last keyframe, reset the time here.
    else if (m_autoLock && getTime() > getCoreAnimation()->getDuration())
    {
      setState(STATE_STOPPED);
      setTime(getCoreAnimation()->getDuration());
    }      
  }

  // handle OUT phase
  if(getState() == STATE_OUT)
  {
    // check if we are still in the OUT phase
    if(getTime() < getCoreAnimation()->getDuration())
    {
      setWeight((getCoreAnimation()->getDuration() - getTime()) / m_delayOut * m_weightTarget);
    }
    else
    {
      // we reached the end of the action animation
      setWeight(0.0f);
      return false;
    }
  }

  return true;

}
Пример #2
0
int IsometricTile::setWeight( Tileset::Weight weight )
{
	setWeight( weight, Orientation::North );
	setWeight( weight, Orientation::South );
	setWeight( weight, Orientation::West );
	setWeight( weight, Orientation::East );
}
Пример #3
0
//----------------------------------------------------------------------------------------------------------------------
void CTRNN::knockOut(int n)
{
  for (int i = 0; i < size; ++i)
  {
    setWeight(i, n, 0);
    setWeight(n, i, 0);
  }
}
Пример #4
0
KateAttribute& KateAttribute::operator+=(const KateAttribute& a)
{
  if (a.itemSet(Weight))
    setWeight(a.weight());

  if (a.itemSet(Italic))
    setItalic(a.italic());

  if (a.itemSet(Underline))
    setUnderline(a.underline());

  if (a.itemSet(Overline))
    setOverline(a.overline());

  if (a.itemSet(StrikeOut))
    setStrikeOut(a.strikeOut());

  if (a.itemSet(Outline))
    setOutline(a.outline());

  if (a.itemSet(TextColor))
    setTextColor(a.textColor());

  if (a.itemSet(SelectedTextColor))
    setSelectedTextColor(a.selectedTextColor());

  if (a.itemSet(BGColor))
    setBGColor(a.bgColor());

  if (a.itemSet(SelectedBGColor))
    setSelectedBGColor(a.selectedBGColor());

  return *this;
}
Пример #5
0
 Mammals(char *k, char *name=NULL): Animal(k)
 {
     drink_milk = true;
     kind = "Mammals";
     setWeight(16);
     //std::cout << "Constructor Mammals" << std::endl;
 }
Пример #6
0
Graph* createMinSpanningTree(List *list, int size)
{
	int *id = new int[size] { 0 };
	for (int i = 0; i < size; ++i)
	{
		id[i] = i;
	}

	Graph* graph = createGraph(size);

	while (!isEmpty(list))
	{
		Road road = getValue(list);
		pop(list);
		int from = road.from;
		int to = road.to;
		int weight = road.weight;
		if (id[from] != id[to])
		{
			for (int i = 0; i < size; ++i)
			{
				if (id[i] == id[to])
				{
					id[i] = id[from];
				}
			}
			setWeight(graph, from, to, weight);
		}
	}
	delete[] id;
	return graph;
}
Пример #7
0
MobileDive::MobileDive(dive *d)
{
	m_thisDive = d;
	setDiveNumber(QString::number(d->number));
	setDiveId(QString::number(d->id));

	dive_trip *trip = d->divetrip;

	if(trip) {
		//trip is valid
		setTrip(trip->location);
	}

	setDate(get_dive_date_string(d->when));
	setDepth(get_depth_string(d->maxdepth));
	setDuration(get_dive_duration_string(d->duration.seconds, "h:","min"));

	setupDiveTempDetails();

	weight_t tw = { total_weight(d) };
	setWeight(weight_string(tw.grams));

	setSuit(QString(d->suit));
	setCylinder(QString(d->cylinder[0].type.description));
	setSac(QString::number(d->sac));
	setLocation(get_dive_location(d));
	setNotes(d->notes);
	setBuddy(d->buddy);
	setDivemaster(d->divemaster);
}
Пример #8
0
Mandel::Mandel(int width, int height, double xmin, double xmax, double ymin, double ymax, uint nmax, ColorType type): width(width), height(height), xmin(xmin), xmax(xmax), ymin(ymin), ymax(ymax), nmax(nmax), res(init_res), broad(false), type(type), list(1){
	map = std::vector<std::vector<double>>(width);
	for(auto& column : map){
		column = std::vector<double>(height);
	}
	setWeight(init_sigma[1]);
}
Пример #9
0
void
TDECModuleInfo::loadAll() 
{
  if( !_service ) /* We have a bogus service. All get functions will return empty/zero values */
    return;

  _allLoaded = true;

  // library and factory
  setHandle(_service->property("X-TDE-FactoryName", TQVariant::String).toString());

  TQVariant tmp;

  // read weight
  tmp = _service->property( "X-TDE-Weight", TQVariant::Int );
  setWeight( tmp.isValid() ? tmp.toInt() : 100 );

  // does the module need super user privileges?
  tmp = _service->property( "X-TDE-RootOnly", TQVariant::Bool );
  setNeedsRootPrivileges( tmp.isValid() ? tmp.toBool() : false );

  // does the module need to be shown to root only?
  // Deprecated ! KDE 4
  tmp = _service->property( "X-TDE-IsHiddenByDefault", TQVariant::Bool );
  setIsHiddenByDefault( tmp.isValid() ? tmp.toBool() : false );

  // get the documentation path
  setDocPath( _service->property( "DocPath", TQVariant::String ).toString() );

  tmp = _service->property( "X-TDE-Test-Module", TQVariant::Bool );
  setNeedsTest( tmp.isValid() ? tmp.asBool() : false );
}
Пример #10
0
weapon::weapon (string name, CHARACTER_WEAPON type, SIZE_CATEGORY size, int damage, int dice, int range, 
		double value, double weight, bool reach, int enhancementBonus, DAMAGE_TYPE one, 
		DAMAGE_TYPE two, DAMAGE_TYPE three, WEAPON_CATEGORY cat, WEAPON_SUBCATEGORY subcat, int critChance,
			int critValue, MATERIAL substance ) {

	setItemName(name);
	setDamageDie(damage);
	setNumDMGDice(dice);
	setWeaponType(type);
	setRangeIncrement(range);
	setWeight(weight);
	setBaseValue(value);
	setHardness(subcat, substance, enhancementBonus);
	setDurability(subcat, substance, enhancementBonus, size);
	setSize(size);
	setReach(reach);
	setDamageType1( one );
	setDamageType2( two );
	setDamageType3( three );
	setCritChance(critChance);
	setCritValue(critValue);
	setWeaponCategory( cat );
	setWeaponSubCategory ( subcat );
	setEnhancementBonus (enhancementBonus);
}
Пример #11
0
BOOL LLDriverParam::setInfo(LLDriverParamInfo *info)
{
	llassert(mInfo == NULL);
	if (info->mID < 0)
		return FALSE;
	mInfo = info;
	mID = info->mID;

	setWeight(getDefaultWeight(), FALSE );
	
	LLDriverParamInfo::entry_info_list_t::iterator iter;
	mDriven.reserve(getInfo()->mDrivenInfoList.size());
	for (iter = getInfo()->mDrivenInfoList.begin(); iter != getInfo()->mDrivenInfoList.end(); iter++)
	{
		LLDrivenEntryInfo *driven_info = &(*iter);
		S32 driven_id = driven_info->mDrivenID;
		LLViewerVisualParam* param = (LLViewerVisualParam*)mAvatarp->getVisualParam( driven_id );
		if (param)
		{
			mDriven.push_back(LLDrivenEntry( param, driven_info ));
		}
		else
		{
			llerrs << "<driven> Unable to resolve driven parameter: " << driven_id << llendl;
			mInfo = NULL;
			return FALSE;
		}
	}
	
	return TRUE;
}
Пример #12
0
TnooFont::TnooFont(int pointSize) :
    QFont(QStringLiteral("nootka"), pointSize)
{
    setPixelSize(pointSize);
    setBold(false);
    setWeight(50); // Normal
}
Пример #13
0
//-----------------------------------------------------------------------------
// setInfo()
//-----------------------------------------------------------------------------
BOOL LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info)
{
	llassert(mInfo == NULL);
	if (info->mID < 0)
		return FALSE;
	mInfo = info;
	mID = info->mID;
	setWeight(getDefaultWeight(), FALSE );

	LLVOAvatar* avatarp = mMesh->getAvatar();
	LLPolyMorphTargetInfo::volume_info_list_t::iterator iter;
	for (iter = getInfo()->mVolumeInfoList.begin(); iter != getInfo()->mVolumeInfoList.end(); iter++)
	{
		LLPolyVolumeMorphInfo *volume_info = &(*iter);
		for (S32 i = 0; i < avatarp->mNumCollisionVolumes; i++)
		{
			if (avatarp->mCollisionVolumes[i].getName() == volume_info->mName)
			{
				mVolumeMorphs.push_back(LLPolyVolumeMorph(&avatarp->mCollisionVolumes[i],
														  volume_info->mScale,
														  volume_info->mPos));
				break;
			}
		}
	}

	mMorphData = mMesh->getMorphData(getInfo()->mMorphName);
	if (!mMorphData)
	{
		llwarns << "No morph target named " << getInfo()->mMorphName << " found in mesh." << llendl;
		return FALSE;  // Continue, ignoring this tag
	}
	return TRUE;
}
Пример #14
0
void FontDescription::setTraits(FontTraits traits)
{
    setStyle(traits.style());
    setVariant(traits.variant());
    setWeight(traits.weight());
    setStretch(traits.stretch());
}
Пример #15
0
void LLTexLayerParamAlpha::setAnimationTarget(F32 target_value, BOOL upload_bake)
{ 
	// do not animate dummy parameters
	if (mIsDummy)
	{
		setWeight(target_value, upload_bake);
		return;
	}

	mTargetWeight = target_value; 
	setWeight(target_value, upload_bake); 
	mIsAnimating = TRUE;
	if (mNext)
	{
		mNext->setAnimationTarget(target_value, upload_bake);
	}
}
Пример #16
0
QtNativeFont::QtNativeFont(QFont const &font)
    : NativeFont(font.family()), d(new Instance)
{
    d->font = font;
    setSize(font.pointSizeF());
    setWeight(font.weight());
    setStyle(font.italic()? Italic : Regular);
}
Пример #17
0
bool DrawingManager::switchDrawing(int num, double weight){
    setWeight(weight);
    if(num<savedDrawings.size()){
       currentShapes = &savedDrawings[num];
        indexed=true;
    }
    
}
Пример #18
0
void MenuPageHandler::setNum4(int n){
    if (item4_num != n) {
        item4_num = n;
        setTotal(calculate_total_price());
        setWeight(calculate_total_weight());
        emit num4Changed();
    }
}
Пример #19
0
void NNetwork::connect(int a, int b, fptype w)
{
    // if there's no connection between a and b,
    // connect a and b
    // (connect does not change existing connections)
    if (getWeight(a, b, w))
        setWeight(a, b, w);
}
Пример #20
0
Veilron::Veilron(Inventory* p, int stack) : Resource(p){
	setName("Veilron");
	setWeight(float(0.1));
	setSymbol(new Symbol('*', 0, BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED));
	setItemID(getNextID());
	setStack(stack);
	totWeight = getWeight()*stack;
	setResourceType(veilron);
}
Пример #21
0
Neithal::Neithal(Inventory* p, int stack) : Resource(p){
	setName("Neithal");
	setWeight(float(0.1));
	setSymbol(new Symbol('*', 1));
	setItemID(getNextID());
	setStack(stack);
	totWeight = getWeight()*stack;
	setResourceType(neithal);
}
Пример #22
0
Leather::Leather(Inventory* p, int stack) : Resource(p){
	setName("Leather");
	setWeight(float(0.1));
	setSymbol(new Symbol('*', 14));
	setItemID(getNextID());
	setStack(stack);
	totWeight = getWeight()*stack;
	setResourceType(leather);
}
Пример #23
0
Selentine::Selentine(Inventory* p, int stack) : Resource(p){
	setName("Selentine");
	setWeight(float(0.1));
	setSymbol(new Symbol('*', 7));
	setItemID(getNextID());
	setStack(stack);
	totWeight = getWeight()*stack;
	setResourceType(selentine);
}
Пример #24
0
Wood::Wood(Inventory* p, int stack) : Resource(p){
	setName("Wood");
	setWeight(float(0.1));
	setSymbol(new Symbol('*', 6));
	setItemID(getNextID());
	setStack(stack);
	totWeight = getWeight()*stack;
	setResourceType(wood);
}
Пример #25
0
Cloth::Cloth(Inventory* p, int stack) : Resource(p){
	setName("Cloth");
	setWeight(float(0.1));
	setSymbol(new Symbol('*', 7));
	setItemID(getNextID());
	setStack(stack);
	totWeight = getWeight()*stack;
	setResourceType(cloth);
}
Пример #26
0
Iron::Iron(Inventory* p, int stack) : Resource(p){
	setName("Iron");
	setWeight(float(0.5));
	setSymbol(new Symbol('*', 8));
	setItemID(getNextID());
	setStack(stack);
	totWeight = getWeight()*stack;
	setResourceType(iron);
}
Пример #27
0
Theyril::Theyril(Inventory* p, int stack) : Resource(p){
	setName("Theyril");
	setWeight(float(0.1));
	setSymbol(new Symbol('*', 15));
	setItemID(getNextID());
	setStack(stack);
	totWeight = getWeight()*stack;
	setResourceType(theyril);
}
Пример #28
0
Assessment::Assessment(string name, int numOfSubs, float groupWeight) : AbstractAssessment(name)
{
	name = "sub" + name;
	setWeight(groupWeight);
	for (int i = 1; i <= numOfSubs; i++)
	{
		addOpportunity(name, 0, groupWeight/numOfSubs);
	}	
}
Пример #29
0
void ICO::updateWeights(){
  NeuronList::iterator it=inputNeurons.begin();
  std::advance(it,1);
  for(; it!=inputNeurons.end(); it++){
    double weight;
    weight=rate_ico*(inputNeurons[0]->getInput()-oldReflexiveInput)*(*it)->getInput();
    setWeight(outputNeuron, (*it), weight+getWeight(outputNeuron, (*it)));
  }
}
Пример #30
0
bool VPathNode::fromString( const String &pString )
{
    // Split Data.
    // {Position} {Rotation} {Weight}
    const char *baseData = StringUnit::getUnit( pString.c_str(), 0, "\t" );

    Point3F  pos;
    AngAxisF aa;
    F32      weight;

    // Scan Base.
    dSscanf( baseData, "%g %g %g %g %g %g %g %g", &pos.x, &pos.y, &pos.z,
                                                  &aa.axis.x, &aa.axis.y, &aa.axis.z, &aa.angle,
                                                  &weight );

    // Apply Changes.
    setLocalPosition( pos );
    setLocalRotation( QuatF( aa ) );
    setWeight( weight );

    // Fetch Orientation Data.
    String orientationData = StringUnit::getUnit( pString.c_str(), 1, "\t" );

    // Fetch Orientation Type.
    String orientationTypeString = orientationData;
    if ( orientationData.find( " " ) )
    {
        // Use First Word.
        orientationTypeString = orientationData.substr( 0, orientationData.find( " " ) );
    }

    // Set Orientation Type.
    const eOrientationType &orientationType = getOrientationTypeEnum( orientationTypeString.c_str() );
    switch( orientationType )
    {
        case k_OrientationFree : 
            {
                // Apply Mode.
                setOrientationMode( orientationType );

            } break;

        case k_OrientationToPoint:
            {
                // Fetch Point.
                Point3F lookAtPoint;
                // Buffer String.
                dSscanf( orientationData.c_str(), "%*s %f %f %f", &lookAtPoint.x, &lookAtPoint.y, &lookAtPoint.z );

                // Apply Mode.
                setOrientationMode( orientationType, lookAtPoint );

            } break;
    }

    return true;
}