Example #1
0
RigidBody::RigidBody(Rect rect)
{
	float width = (rect.right - rect.left);
	float height = (rect.bottom - rect.top);

	// Create a Rectangle shape - origin middle
	mShape = new Shape();
	mShape->setOrigin(Vector(rect.left + width/2, rect.top + height/2, 0));
	mShape->addPoint(Vector(-width/2, -height/2, 0));	// top - left
	mShape->addPoint(Vector(-width/2, height/2, 0));	// bottom - left
	mShape->addPoint(Vector(width/2, height/2, 0));   // bottom - right
	mShape->addPoint(Vector(width/2, -height/2, 0));	// top - right

	setStatic(false);
	mAlive = true;
	mTexture = NULL;

	SetMass(1);
	SetVelocity(0, 0);
	SetAngularVelocity(0.0f);
	SetForce(Vector(0, 0, 0));
	SetTorque(Vector(0, 0, 0));
	SetMomentum(Vector(0, 0, 0));
	SetFriction(1.0f);
	SetSleeping(false);
}
Mainframe::Mainframe() {
	setSolid(true);
	setStatic(true);

	compTexture.loadFromFile("img/mastermind.png");

	computer.setTexture(compTexture);

	computer.setOrigin(121, 97);
	computer.setRotation(90);
	setRotation(90);


	Rect* r = new Rect(vec::Vector2(-121, -97), vec::Vector2(121, 97));
	col.addShape(r);

	col.rotateTo(toRadians(90));

	maxHealth = 500;
	curHealth = maxHealth;

	state = HEALTHY;

	setTag(sf::String("Boss"));

	Global::objective = getPosition();
}
PlayerStructureTerminal::PlayerStructureTerminal() : Terminal()
{
	mStructure = 0;
	setStatic(true);

	
}
Example #4
0
void Entity::removeFromScene() {
    Ogre::SceneNode *oldParent = mSceneNode->getParentSceneNode();
    if (oldParent) {
        oldParent->removeChild(mSceneNode);
    }
    setStatic(true);
}
Example #5
0
void Entity::addToScene(Ogre::SceneNode *newParent) {
    if (newParent == NULL) {
        newParent = mScene->getSceneManager()->getRootSceneNode();
    }
    removeFromScene();
    newParent->addChild(mSceneNode);
    setStatic(false); // May get set to true after the next frame has drawn.
}
Example #6
0
void Entity::resetLocation(Time ti, const Location &newLocation) {
    SILOG(ogre,debug,"ResetLocation "<<this<<" to "<<newLocation.getPosition()<<"; "<<newLocation.getOrientation());
    if (!getProxy().isStatic(ti)) {
        setStatic(false);
    } else {
        setOgrePosition(newLocation.getPosition());
        setOgreOrientation(newLocation.getOrientation());
    }
}
Example #7
0
  Initializer() {
    void* vpEmpty = &s_theEmptyArray;

    auto const ad   = static_cast<ArrayData*>(vpEmpty);
    ad->m_kind      = ArrayData::kEmptyKind;
    ad->m_size      = 0;
    ad->m_pos       = ArrayData::invalid_index;
    ad->m_count     = 0;
    ad->setStatic();
  }
Example #8
0
void ComponentDock::staticChanged(int Value) {
	if (eman != nullptr) {
		auto ent = eman->getEntity(currEntity);
		if (ent) {
			bool state = false;
			if (Value == Qt::CheckState::Checked) state = true;
			ent->setStatic(state);
			emit(entityStaticChanged(ent));
		}
	}
}
Example #9
0
bool AlCMethod::read(AlDatabase &db)
{
  const char *key = db.currentKey();
  if (strcmp(key, "name")==0) {
    name(db.currentValue());
  } else if (strcmp(key, "static")==0) {
    setStatic(db.currentValueAsBool());
  } else if (strcmp(key, "const")==0) {
    setConst(db.currentValueAsBool());
  } else {
    return AlARMCode::read(db);
  }
  return true;
}
Example #10
0
StringData* StringData::MakeEmpty() {
  void* vpEmpty = &s_theEmptyString;

  auto const sd = static_cast<StringData*>(vpEmpty);
  auto const data = reinterpret_cast<char*>(sd + 1);

  sd->m_data        = data;
  sd->m_hdr.init(HeaderKind::String, 0);
  sd->m_lenAndHash  = 0; // len=0, hash=0
  data[0] = 0;

  sd->setStatic();

  assert(sd->m_len == 0);
  assert(sd->capacity() == 0);
  assert(sd->m_hdr.kind == HeaderKind::String);
  assert(sd->isFlat());
  assert(sd->isStatic());
  assert(sd->checkSane());
  return sd;
}
Example #11
0
Element::Element() : Quad()
{
	elementFlag = EF_NONE;
	wavyFlip = false;
	elementEffectIndex = -1;
	elementActive = true;
	bgLayer = 0;

	wavyAngleOffset=0;
	wavyMagnitude=0;
	wavyLerpIn=0;
	wavyWaving=false;
	wavyFlip=false;

	elementEffectType = 0;
	wavyRadius = 0;
	wavyMin = 0;
	wavyMax = 0;
	templateIdx = -1;

	setStatic(true);
}
Example #12
0
RigidBody::RigidBody(float x, float y, int width, int height)
{
	// Create a Rectangle shape - origin middle
	mShape = new Shape();
	mShape->setOrigin(Vector(x, y, 0));
	mShape->addPoint(Vector(-width/2, -height/2, 0));	// top - left
	mShape->addPoint(Vector(-width/2, height/2, 0));	// bottom - left
	mShape->addPoint(Vector(width/2, height/2, 0));   // bottom - right
	mShape->addPoint(Vector(width/2, -height/2, 0));	// top - right

	setStatic(false);
	mAlive = true;

	SetMass(1);
	SetVelocity(0, 0);
	SetAngularVelocity(0.0f);
	SetForce(Vector(0, 0, 0));
	SetTorque(Vector(0, 0, 0));
	SetMomentum(Vector(0, 0, 0));
	SetFriction(1.0f);
	SetSleeping(false);
	SetRepeatX(false);
}
Example #13
0
// create either a static or an uncounted string.
// Diffrence between static and uncounted is in the lifetime
// of the string. Static are alive for the lifetime of the process.
// Uncounted are not ref counted but will be deleted at some point.
StringData* StringData::MakeShared(StringSlice sl, bool trueStatic) {
  if (UNLIKELY(sl.len > StringData::MaxSize)) {
    throw_string_too_large(sl.len);
  }

  auto const encodable = roundUpPackedCap(sl.len);
  auto const need = encodable + kCapOverhead;
  auto const sd = static_cast<StringData*>(
    trueStatic ? low_malloc(need) : malloc(need)
  );
  auto const data = reinterpret_cast<char*>(sd + 1);
  auto const capCode = packedCapToCode(encodable);

  sd->m_data        = data;
  sd->m_capAndCount = HeaderKind::String << 24 | capCode; // count=0
  sd->m_lenAndHash  = sl.len; // hash=0

  data[sl.len] = 0;
  auto const mcret = memcpy(data, sl.ptr, sl.len);
  auto const ret   = reinterpret_cast<StringData*>(mcret) - 1;
  // Recalculating ret from mcret avoids a spill.

  assert(ret->m_hash == 0);
  assert(ret->m_count == 0);
  if (trueStatic) {
    ret->setStatic();
  } else {
    ret->setUncounted();
  }

  assert(ret == sd);
  assert(ret->isFlat());
  assert(trueStatic ? ret->isStatic() : ret->isUncounted());
  assert(ret->checkSane());
  return ret;
}
Example #14
0
// create either a static or an uncounted string.
// Diffrence between static and uncounted is in the lifetime
// of the string. Static are alive for the lifetime of the process.
// Uncounted are not ref counted but will be deleted at some point.
ALWAYS_INLINE
StringData* StringData::MakeShared(StringSlice sl, bool trueStatic) {
  if (UNLIKELY(sl.len > StringData::MaxSize)) {
    throw_string_too_large(sl.len);
  }

  auto const cc = CapCode::ceil(sl.len);
  auto const need = cc.decode() + kCapOverhead;
  auto const sd = static_cast<StringData*>(
    trueStatic ? low_malloc(need) : malloc(need)
  );
  auto const data = reinterpret_cast<char*>(sd + 1);

  sd->m_data        = data;
  sd->m_hdr.init(cc, HeaderKind::String, 0);
  sd->m_lenAndHash  = sl.len; // hash=0

  data[sl.len] = 0;
  auto const mcret = memcpy(data, sl.ptr, sl.len);
  auto const ret   = reinterpret_cast<StringData*>(mcret) - 1;
  // Recalculating ret from mcret avoids a spill.

  assert(ret->m_hash == 0);
  assert(ret->getCount() == 0);
  if (trueStatic) {
    ret->setStatic();
  } else {
    ret->setUncounted();
  }

  assert(ret == sd);
  assert(ret->isFlat());
  assert(trueStatic ? ret->isStatic() : ret->isUncounted());
  assert(ret->checkSane());
  return ret;
}
Example #15
0
void Element::setElementEffectByIndex(int eidx)
{
	deleteGrid();

	setBlendType(RenderObject::BLEND_DEFAULT);
	alpha.stop();
	alpha = 1;

	elementEffectIndex = eidx;

	ElementEffect e = dsq->getElementEffectByIndex(eidx);

	switch(e.type)
	{
	case EFX_SEGS:
	{
		setSegs(e.segsx, e.segsy, e.segs_dgox, e.segs_dgoy, e.segs_dgmx, e.segs_dgmy, e.segs_dgtm, e.segs_dgo);
		setStatic(false);
	}
	break;
	case EFX_ALPHA:
	{
		setBlendType(e.blendType);
		alpha = e.alpha;
		setStatic(false);
	}
	break;
	case EFX_WAVY:
	{
		/*
		char buf[256];
		sprintf(buf, "setting wavy segsy: %d radius: %d min: %d max: %d", e.segsy, e.wavy_radius, e.wavy_min, e.wavy_max);
		debugLog(buf);
		*/
		wavy.resize(e.segsy);
		float bity = float(getHeight())/float(e.segsy);
		for (int i = 0; i < wavy.size(); i++)
		{
			wavy[i] = Vector(0, -(i*bity));
		}
		//wavySave = wavy;
		wavyRadius = e.wavy_radius;
		wavyFlip = e.wavy_flip;
		wavyMin = bity;
		wavyMax = bity*1.2f;

		//wavyRadius = 8;

		createGrid(2, e.segsy);

		setGridFromWavy();

		//createGrid(8,8);
		/*
		wavyMin = e.wavy_min;
		wavyMax = e.wavy_max;
		*/
		setStatic(false);
	}
	break;
	default:
		setStatic(true);
	break;
	}
	elementEffectType = e.type;
}
Example #16
0
void QUmlConnectorObject::unsetStatic()
{
    Q_D(QModelingObject);
    setStatic(false);
    d->modifiedResettableProperties.removeAll(QStringLiteral("isStatic"));
}
Example #17
0
void Entity::extrapolateLocation(TemporalValue<Location>::Time current) {
    Location loc (getProxy().extrapolateLocation(current));
    setOgrePosition(loc.getPosition());
    setOgreOrientation(loc.getOrientation());
    setStatic(getProxy().isStatic(current));
}