Example #1
0
void QDeclarativeGrid::doPositioning()
{
    int c=_columns,r=_rows;//Actual number of rows/columns
    int numVisible = positionedItems.count();
    if (_columns==-1 && _rows==-1){
        c = 4;
        r = (numVisible+3)/4;
    }else if (_rows==-1){
        r = (numVisible+(_columns-1))/_columns;
    }else if (_columns==-1){
        c = (numVisible+(_rows-1))/_rows;
    }

    QList<int> maxColWidth;
    QList<int> maxRowHeight;
    int childIndex =0;
    for (int i=0; i<r; i++){
        for (int j=0; j<c; j++){
            if (j==0)
                maxRowHeight << 0;
            if (i==0)
                maxColWidth << 0;

            if (childIndex == positionedItems.count())
                continue;
            const PositionedItem &child = positionedItems.at(childIndex++);
            if (!child.item || isInvisible(child.item))
                continue;
            if (child.item->width() > maxColWidth[j])
                maxColWidth[j] = child.item->width();
            if (child.item->height() > maxRowHeight[i])
                maxRowHeight[i] = child.item->height();
        }
    }

    int xoffset=0;
    int yoffset=0;
    int curRow =0;
    int curCol =0;
    for (int i = 0; i < positionedItems.count(); ++i) {
        const PositionedItem &child = positionedItems.at(i);
        if (!child.item || isInvisible(child.item))
            continue;
        if((child.item->x()!=xoffset)||(child.item->y()!=yoffset)){
            positionX(xoffset, child);
            positionY(yoffset, child);
        }
        xoffset+=maxColWidth[curCol]+spacing();
        curCol++;
        curCol%=c;
        if (!curCol){
            yoffset+=maxRowHeight[curRow]+spacing();
            xoffset=0;
            curRow++;
            if (curRow>=r)
                break;
        }
    }
}
Example #2
0
void Monster::drainHealth(Creature* attacker, CombatType_t combatType, int32_t damage)
{
	Creature::drainHealth(attacker, combatType, damage);

	if(isInvisible())
		removeCondition(CONDITION_INVISIBLE);
}
Example #3
0
void Player::Draw()
{
	CalculateStats();
	cleanupActiveSpells();
	cleanupCooldownSpells();
	direction_texture = GetDirectionTexture();
	ActivityType::ActivityType curActivity = getCurActivity();
	if (alive == true)
	{
		int drawX = x_pos;
		int drawY = y_pos;
		if( getUseBoundingBox() )
		{
			drawX -= getBoundingBoxX();
			drawY -= getBoundingBoxY();
		}

		float color[] = { 1.0f, 1.0f, 1.0f, 1.0f };

		// if player is invisible we draw at 0.2 transparency.. if sneaking we draw at 0.5 and with darker colors (shade)
		if( isSneaking() == true )
		{
		    color[0] = 0.7f;
		    color[1] = 0.7f;
		    color[2] = 0.7f;
		    color[3] = 0.5f;
		}
		else if ( isInvisible() == true )
		{
			color[3] = 0.2f;
		}
		texture[ static_cast<size_t>(curActivity) ]->DrawTexture( drawX, drawY, direction_texture, color[3], color[0], color[1], color[2] );
	}
}
Example #4
0
void Actor::drainHealth(CombatType combatType, const CombatSource& combatSource, int32_t damage, bool showtext)
{
  Creature::drainHealth(combatType, combatSource, damage, showtext);

  if(isInvisible()){
    removeCondition(CONDITION_INVISIBLE);
  }
}
Example #5
0
void WidgetButton::show() {
	if (isInvisible())
		return;

	Widget::show();

	if (_iconQuad)
		_iconQuad->show();
}
Example #6
0
void WidgetScrollbar::show() {
	if (isVisible())
		return;

	if (!isInvisible())
		_scrollbar.show();

	NWNWidget::show();
}
Example #7
0
void WidgetProgressbar::show() {
	if (isVisible() || isInvisible())
		return;

	KotORJadeWidget::show();

	if (_progress)
		_progress->show();
}
Example #8
0
void ModelWidget::show() {
	if (isVisible())
		return;

	if (!isInvisible())
		_model->show();

	NWNWidget::show();
}
Example #9
0
void PortraitWidget::show() {
	if (isVisible())
		return;

	if (!isInvisible())
		_portrait.show();

	NWNWidget::show();
}
Example #10
0
void KotORWidget::show() {
	if (isInvisible())
		return;

	Widget::show();

	if (_quad)
		_quad->show();
	if (_text)
		_text->show();
}
Example #11
0
void KotORWidget::hide() {
	if (isInvisible())
		return;

	if (_quad)
		_quad->hide();
	if (_text)
		_text->hide();

	Widget::hide();
}
Example #12
0
static void _move_lasers(CANNON *c) {
  unsigned i, ignoring = 0;
  for (i = 0; i < MAX_LASERS_AT_ONCE; i++) {
    if (!c->lasers[i].valid)
      continue;
    c->lasers[i].pos->points[0].x += sinf(c->lasers[i].pos->rotation) * LASER_SPEED;
    c->lasers[i].pos->points[0].y -= cosf(c->lasers[i].pos->rotation) * LASER_SPEED;
    c->lasers[i].pos->center = c->lasers[i].pos->points[0];
    c->lasers[i].pos->points[1].x = c->lasers[i].pos->points[0].x;
    c->lasers[i].pos->points[1].y = c->lasers[i].pos->points[0].y + LASER_HEIGHT;

    object_position_rotate_points(c->lasers[i].pos, c->lasers[i].pos->rotation);

    if (isInvisible(c->lasers[i].pos->points[0], c->display) &&
	isInvisible(c->lasers[i].pos->points[1], c->display)) {
      c->lasers[i].valid = false;
      ignoring++;
    }
  }
  c->totalLasers -= ignoring;
}
Example #13
0
void RAttributeEntity::exportEntity(RExporter& e, bool preview, bool forceSelected) const {
    Q_UNUSED(preview);
    Q_UNUSED(forceSelected);

    if (!isInvisible()) {
        if (RSettings::isTextRenderedAsText()) {
            QList<RPainterPath> paths = e.exportText(getData(), forceSelected);
            e.exportPainterPaths(paths);
        }
        else {
            e.exportPainterPathSource(getData());
        }
    }
}
Example #14
0
void QDeclarativeRow::doPositioning()
{
    int hoffset = 0;

    for (int ii = 0; ii < positionedItems.count(); ++ii) {
        const PositionedItem &child = positionedItems.at(ii);
        if (!child.item || isInvisible(child.item))
            continue;

        if(child.item->x() != hoffset)
            positionX(hoffset, child);

        hoffset += child.item->width();
        hoffset += spacing();
    }
}
Example #15
0
void QDeclarativeColumn::doPositioning()
{
    int voffset = 0;

    for (int ii = 0; ii < positionedItems.count(); ++ii) {
        const PositionedItem &child = positionedItems.at(ii);
        if (!child.item || isInvisible(child.item))
            continue;

        if(child.item->y() != voffset)
            positionY(voffset, child);

        voffset += child.item->height();
        voffset += spacing();
    }
}
Example #16
0
void QDeclarativeFlow::doPositioning(QSizeF *contentSize)
{
    Q_D(QDeclarativeFlow);

    int hoffset = 0;
    int voffset = 0;
    int linemax = 0;

    for (int i = 0; i < positionedItems.count(); ++i) {
        const PositionedItem &child = positionedItems.at(i);
        if (!child.item || isInvisible(child.item))
            continue;

        if (d->flow == LeftToRight)  {
            if (hoffset && hoffset + child.item->width() > width()) {
                hoffset = 0;
                voffset += linemax + spacing();
                linemax = 0;
            }
        } else {
            if (voffset && voffset + child.item->height() > height()) {
                voffset = 0;
                hoffset += linemax + spacing();
                linemax = 0;
            }
        }

        if(child.item->x() != hoffset || child.item->y() != voffset){
            positionX(hoffset, child);
            positionY(voffset, child);
        }

        contentSize->setWidth(qMax(contentSize->width(), hoffset + child.item->width()));
        contentSize->setHeight(qMax(contentSize->height(), voffset + child.item->height()));

        if (d->flow == LeftToRight)  {
            hoffset += child.item->width();
            hoffset += spacing();
            linemax = qMax(linemax, qCeil(child.item->height()));
        } else {
            voffset += child.item->height();
            voffset += spacing();
            linemax = qMax(linemax, qCeil(child.item->width()));
        }
    }
}
Example #17
0
void QDeclarativeRow::doPositioning(QSizeF *contentSize)
{
    int hoffset = 0;

    for (int ii = 0; ii < positionedItems.count(); ++ii) {
        const PositionedItem &child = positionedItems.at(ii);
        if (!child.item || isInvisible(child.item))
            continue;

        if(child.item->x() != hoffset)
            positionX(hoffset, child);

        contentSize->setHeight(qMax(contentSize->height(), child.item->height()));

        hoffset += child.item->width();
        hoffset += spacing();
    }

    contentSize->setWidth(hoffset - spacing());
}
static bool _set_asteroid_position(ASTEROID *asteroid,
				   POINT display) {
  unsigned p, invisiblePoints;

  p = invisiblePoints = 0;
  //FIXME: Create a better looking asteroid.
  asteroid->pos->points[p] = asteroid->pos->center;
  asteroid->pos->points[p].y -= 20;

  p++;
  asteroid->pos->points[p].x = asteroid->pos->points[p-1].x - 30;
  asteroid->pos->points[p].y = asteroid->pos->points[p-1].y + 10;

  p++;
  asteroid->pos->points[p].x = asteroid->pos->points[p-1].x;
  asteroid->pos->points[p].y = asteroid->pos->points[p-1].y + 20;

  p++;
  asteroid->pos->points[p].x = asteroid->pos->points[p-1].x + 30;
  asteroid->pos->points[p].y = asteroid->pos->points[p-1].y + 20;

  p++;
  asteroid->pos->points[p].x = asteroid->pos->points[p-1].x + 30;
  asteroid->pos->points[p].y = asteroid->pos->points[p-1].y - 20;

  p++;
  asteroid->pos->points[p].x = asteroid->pos->points[p-1].x;
  asteroid->pos->points[p].y = asteroid->pos->points[p-1].y - 20;

  object_position_rotate_points(asteroid->pos, asteroid->pos->rotation);

  for (p = 0; p < ASTEROID_POINTS; p++) {
    if (isInvisible(asteroid->pos->points[p], display))
      invisiblePoints++;
  }
  return invisiblePoints != ASTEROID_POINTS;
}
Example #19
0
void RPropertyAttributes::mixWith(const RPropertyAttributes & other) {
    setAffectsOtherProperties(affectsOtherProperties() || other.affectsOtherProperties());
    setInvisible(isInvisible() || other.isInvisible());
    choices.intersect(other.choices);
}
Example #20
0
void QDeclarativeGrid::doPositioning(QSizeF *contentSize)
{
    int c = m_columns;
    int r = m_rows;
    int numVisible = positionedItems.count();
    if (m_columns <= 0 && m_rows <= 0){
        c = 4;
        r = (numVisible+3)/4;
    } else if (m_rows <= 0){
        r = (numVisible+(m_columns-1))/m_columns;
    } else if (m_columns <= 0){
        c = (numVisible+(m_rows-1))/m_rows;
    }

    QList<int> maxColWidth;
    QList<int> maxRowHeight;
    int childIndex =0;
    if (m_flow == LeftToRight) {
        for (int i=0; i < r; i++){
            for (int j=0; j < c; j++){
                if (j==0)
                    maxRowHeight << 0;
                if (i==0)
                    maxColWidth << 0;

                if (childIndex == positionedItems.count())
                    continue;
                const PositionedItem &child = positionedItems.at(childIndex++);
                if (!child.item || isInvisible(child.item))
                    continue;
                if (child.item->width() > maxColWidth[j])
                    maxColWidth[j] = child.item->width();
                if (child.item->height() > maxRowHeight[i])
                    maxRowHeight[i] = child.item->height();
            }
        }
    } else {
        for (int j=0; j < c; j++){
            for (int i=0; i < r; i++){
                if (j==0)
                    maxRowHeight << 0;
                if (i==0)
                    maxColWidth << 0;

                if (childIndex == positionedItems.count())
                    continue;
                const PositionedItem &child = positionedItems.at(childIndex++);
                if (!child.item || isInvisible(child.item))
                    continue;
                if (child.item->width() > maxColWidth[j])
                    maxColWidth[j] = child.item->width();
                if (child.item->height() > maxRowHeight[i])
                    maxRowHeight[i] = child.item->height();
            }
        }
    }

    int xoffset=0;
    int yoffset=0;
    int curRow =0;
    int curCol =0;
    for (int i = 0; i < positionedItems.count(); ++i) {
        const PositionedItem &child = positionedItems.at(i);
        if (!child.item || isInvisible(child.item))
            continue;
        if((child.item->x()!=xoffset)||(child.item->y()!=yoffset)){
            positionX(xoffset, child);
            positionY(yoffset, child);
        }

        if (m_flow == LeftToRight) {
            contentSize->setWidth(qMax(contentSize->width(), xoffset + child.item->width()));
            contentSize->setHeight(yoffset + maxRowHeight[curRow]);

            xoffset+=maxColWidth[curCol]+spacing();
            curCol++;
            curCol%=c;
            if (!curCol){
                yoffset+=maxRowHeight[curRow]+spacing();
                xoffset=0;
                curRow++;
                if (curRow>=r)
                    break;
            }
        } else {
            contentSize->setHeight(qMax(contentSize->height(), yoffset + child.item->height()));
            contentSize->setWidth(xoffset + maxColWidth[curCol]);

            yoffset+=maxRowHeight[curRow]+spacing();
            curRow++;
            curRow%=r;
            if (!curRow){
                xoffset+=maxColWidth[curCol]+spacing();
                yoffset=0;
                curCol++;
                if (curCol>=c)
                    break;
            }
        }
    }
}
void TangibleObjectImplementation::sendTo(SceneObject* player, bool doClose) {
	if (isInvisible() && player != asTangibleObject())
		return;

	SceneObjectImplementation::sendTo(player, doClose);
}