Example #1
0
void Game_Event::Setup(RPG::EventPage* new_page) {
	bool from_null = page == NULL;
	page = new_page;

	// Free resources if needed
	if (interpreter) {
		// If the new page is null and the interpreter is running, it should
		// carry on executing its command list during this frame
		if (page)
			interpreter->Clear();
		Game_Map::ReserveInterpreterDeletion(interpreter);
		interpreter.reset();
	}

	if (page == NULL) {
		tile_id = 0;
		SetSpriteName("");
		SetSpriteIndex(0);
		SetDirection(RPG::EventPage::Direction_down);
		//move_type = 0;
		trigger = -1;
		list.clear();
		return;
	}
	SetSpriteName(page->character_name);
	SetSpriteIndex(page->character_index);

	tile_id = page->character_name.empty() ? page->character_index : 0;

	if (original_pattern != page->character_pattern) {
		pattern = page->character_pattern;
		original_pattern = pattern;
	}

	move_type = page->move_type;
	SetMoveSpeed(page->move_speed);
	SetMoveFrequency(page->move_frequency);
	max_stop_count = (GetMoveFrequency() > 7) ? 0 : (int)pow(2.0, 8 - GetMoveFrequency());
	original_move_frequency = page->move_frequency;
	original_move_route = page->move_route;
	SetOriginalMoveRouteIndex(0);

	bool last_direction_fixed = IsDirectionFixed() || IsFacingLocked();
	animation_type = page->animation_type;

	if (from_null || !(last_direction_fixed || IsMoving()) || IsDirectionFixed())
		SetSpriteDirection(page->character_direction);
	if (!IsMoving())
		SetDirection(page->character_direction);

	SetOpacity(page->translucent ? 160 : 255);
	SetLayer(page->layer);
	data.overlap_forbidden = page->overlap_forbidden;
	trigger = page->trigger;
	list = page->event_commands;

	if (trigger == RPG::EventPage::Trigger_parallel) {
		interpreter.reset(new Game_Interpreter_Map());
	}
}
Example #2
0
plLayer& plLayer::InitToDefault()
{
    fState->Reset();

    *fTexture = nil;

    SetRuntimeColor(hsColorRGBA().Set(0.5f, 0.5f, 0.5f, 1.f));
    SetPreshadeColor(hsColorRGBA().Set(0.5f, 0.5f, 0.5f, 1.f));
    SetAmbientColor(hsColorRGBA().Set(0,0,0,1.f));
    SetOpacity(1.f);

    fTransform->Reset();

    SetUVWSrc(0);
    SetLODBias(-1.f);
    SetSpecularColor( hsColorRGBA().Set(0,0,0,1.f));
    SetSpecularPower(1.f);

    *fVertexShader = nil;
    *fPixelShader = nil;

    fBumpEnvXfm->Reset();

    return *this;
}
Example #3
0
mitk::Material::Material( const Material& property, double red, double green, double blue, double opacity, std::string name )
{
  Initialize( property );
  SetColor( red, green, blue );
  SetOpacity( opacity );
  SetName( name );
}
VScrollBarOverlayWindow::VScrollBarOverlayWindow(nux::Geometry const& geo)
  : nux::BaseWindow("")
  , scale(1.0)
  , content_size_(geo)
  , content_offset_x_(0)
  , mouse_offset_y_(0)
  , current_state_(ThumbState::NONE)
  , current_action_(ThumbAction::NONE)
  , show_animator_(ANIMATION_DURATION)
{
  Area::SetGeometry(content_size_.x, content_size_.y, THUMB_WIDTH.CP(scale), content_size_.height);
  SetBackgroundColor(nux::color::Transparent);
  SetAcceptMouseWheelEvent(true);

  show_animator_.updated.connect(sigc::mem_fun(this, &BaseWindow::SetOpacity));
  show_animator_.finished.connect([this] {
    if (animation::GetDirection(show_animator_) == animation::Direction::BACKWARD)
      ShowWindow(false);
  });

  SetOpacity(0.0f);
  UpdateTexture();

  scale.changed.connect([this] (double scale) {
    UpdateContentGeometry();
    UpdateTexture();
  });
}
Example #5
0
bool
pcl::visualization::PCLContextImageItem::Paint (vtkContext2D *painter)
{
  SetOpacity (1.0);
  painter->DrawImage (x, y, image);
  return (true);
}
Example #6
0
mitk::Material::Material( const Material& property, vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType opacity, std::string name )
{
  Initialize( property );
  SetColor( red, green, blue );
  SetOpacity( opacity );
  SetName( name );
}
Example #7
0
void Game_Event::SetupFromSave(const RPG::EventPage* new_page) {
	page = new_page;

	if (page == nullptr) {
		tile_id = 0;
		trigger = -1;
		list.clear();
		interpreter.reset();
		return;
	}

	data.Fixup(*new_page);

	tile_id = page->character_name.empty() ? page->character_index : 0;

	pattern = page->character_pattern;

	move_type = page->move_type;
	original_move_route = page->move_route;
	animation_type = page->animation_type;
	trigger = page->trigger;
	list = page->event_commands;

	// FIXME: transparency gets not restored otherwise
	SetOpacity(page->translucent ? 160 : 255);

	// Trigger parallel events when the interpreter wasn't already running
	// (because it was the middle of a parallel event while saving)
	if (!interpreter && trigger == RPG::EventPage::Trigger_parallel) {
		interpreter.reset(new Game_Interpreter_Map());
	}
}
void Sprite_Character::Update() {
	Sprite::Update();
	Rect r;
	if (tile_id != character->GetTileId() ||
		character_name != character->GetCharacterName() ||
		character_index != character->GetCharacterIndex()) {
		tile_id = character->GetTileId();
		character_name = character->GetCharacterName();
		character_index = character->GetCharacterIndex();
		if (tile_id > 0) {
			BitmapRef tile = Cache::Tile(Game_Map::GetChipsetName(), tile_id);
			SetBitmap(tile);
			r.Set(0, 0, 16, 16);
			SetSrcRect(r);
			SetOx(8);
			SetOy(16);
		} else {
			if (character_name.empty()) {
				SetBitmap(BitmapRef());
			} else {
				SetBitmap(Cache::Charset(character_name));
				chara_width = GetBitmap()->GetWidth() / 4 / 3;
				chara_height = GetBitmap()->GetHeight() / 2 / 4;
				SetOx(chara_width / 2);
				SetOy(chara_height);
				int sx = (character_index % 4) * chara_width * 3;
				int sy = (character_index / 4) * chara_height * 4;
				r.Set(sx, sy, chara_width * 3, chara_height * 4);
				SetSpriteRect(r);
			}
		}
	}

	if (tile_id == 0) {
		int row = character->GetDirection();
		r.Set(character->GetPattern() * chara_width, row * chara_height, chara_width, chara_height);
		SetSrcRect(r);
	}

	if (character->IsFlashPending()) {
		Color col;
		int dur;
		character->GetFlashParameters(col, dur);
		Flash(col, dur);
	}

	SetVisible(character->GetVisible());
	if (GetVisible()) {
		SetOpacity(character->GetOpacity());
	}

	SetX(character->GetScreenX());
	SetY(character->GetScreenY());
	SetZ(character->GetScreenZ(chara_height));
	
	//SetBlendType(character->GetBlendType());
	//SetBushDepth(character->GetBushDepth());
}
Example #9
0
void
avtTruecolorPlot::SetAtts(const AttributeGroup *a)
{
    const TruecolorAttributes *newAtts = (const TruecolorAttributes *)a;
    needsRecalculation = atts.ChangesRequireRecalculation(*newAtts);
    atts = *newAtts;
    SetOpacity(atts.GetOpacity());
    SetLighting(atts.GetLightingFlag());
}
Example #10
0
void Sprite_Character::Update() {
	Sprite::Update();
	Rect r;
	if (tile_id != character->GetTileId() ||
		character_name != character->GetSpriteName() ||
		character_index != character->GetSpriteIndex()) {
		tile_id = character->GetTileId();
		character_name = character->GetSpriteName();
		character_index = character->GetSpriteIndex();
		if (tile_id > 0) {
			if (tile_request) {
				tile_request->Unbind(tile_request_id);
			}
			tile_request = AsyncHandler::RequestFile("ChipSet", Game_Map::GetChipsetName());
			tile_request_id = tile_request->Bind(&Sprite_Character::OnTileSpriteReady, this);
			tile_request->Start();
		} else {
			if (character_name.empty()) {
				SetBitmap(BitmapRef());
			} else {
				if (char_request) {
					char_request->Unbind(char_request_id);
				}
				char_request = AsyncHandler::RequestFile("CharSet", character_name);
				char_request_id = char_request->Bind(&Sprite_Character::OnCharSpriteReady, this);
				char_request->Start();
			}
		}
	}

	if (tile_id == 0) {
		int row = character->GetSpriteDirection();
		r.Set(character->GetPattern() * chara_width, row * chara_height, chara_width, chara_height);
		SetSrcRect(r);
	}

	if (character->IsFlashPending()) {
		Color col = character->GetFlashColor();
		int dur = character->GetFlashTimeLeft();
		Flash(col, dur);
		// TODO: Gradual decrease of Flash Time Left
		character->SetFlashTimeLeft(0);
	}

	SetVisible(character->GetVisible());
	if (GetVisible()) {
		SetOpacity(character->GetOpacity());
	}

	SetX(character->GetScreenX());
	SetY(character->GetScreenY());
	SetZ(character->GetScreenZ());

	//SetBlendType(character->GetBlendType());
	int bush_split = 4 - character->GetBushDepth();
	SetBushDepth(bush_split > 3 ? 0 : GetHeight() / bush_split);
}
Example #11
0
void Sprite_Character::Update() {
	Sprite::Update();
	Rect r;
	if (tile_id != character->GetTileId() ||
		character_name != character->GetSpriteName() ||
		character_index != character->GetSpriteIndex()) {
		tile_id = character->GetTileId();
		character_name = character->GetSpriteName();
		character_index = character->GetSpriteIndex();
		if (tile_id > 0) {
			BitmapRef tile = Cache::Tile(Game_Map::GetChipsetName(), tile_id);
			SetBitmap(tile);
			r.Set(0, 0, TILE_SIZE, TILE_SIZE);
			SetSrcRect(r);
			SetOx(8);
			SetOy(16);
		} else {
			if (character_name.empty()) {
				SetBitmap(BitmapRef());
			} else {
				SetBitmap(Cache::Charset(character_name));
				SetOx(chara_width / 2);
				SetOy(chara_height);
				int sx = (character_index % 4) * chara_width * 3;
				int sy = (character_index / 4) * chara_height * 4;
				r.Set(sx, sy, chara_width * 3, chara_height * 4);
				SetSpriteRect(r);
			}
		}
	}

	if (tile_id == 0) {
		int row = (character->IsSpinning() ? character->GetPrelockDirection() : character->GetDirection());
		r.Set(character->GetPattern() * chara_width, row * chara_height, chara_width, chara_height);
		SetSrcRect(r);
	}

	if (character->IsFlashPending()) {
		Color col = character->GetFlashColor();
		int dur = character->GetFlashTimeLeft();
		Flash(col, dur);
		// TODO: Gradual decrease of Flash Time Left
		character->SetFlashTimeLeft(0);
	}

	SetVisible(character->GetVisible());
	if (GetVisible()) {
		SetOpacity(character->GetOpacity());
	}

	SetX(character->GetScreenX());
	SetY(character->GetScreenY());
	SetZ(character->GetScreenZ(chara_height));
	
	//SetBlendType(character->GetBlendType());
	//SetBushDepth(character->GetBushDepth());
}
Example #12
0
/** Set the active client. */
void FocusClient(ClientNode *np)
{
   if(np->state.status & STAT_HIDDEN) {
      return;
   }
   if(!(np->state.status & (STAT_CANFOCUS | STAT_TAKEFOCUS))) {
      return;
   }

   if(activeClient != np || !(np->state.status & STAT_ACTIVE)) {

      if(activeClient) {
         activeClient->state.status &= ~STAT_ACTIVE;
         if(!(activeClient->state.status & STAT_OPACITY)) {
            SetOpacity(activeClient, settings.inactiveClientOpacity, 0);
         }
         DrawBorder(activeClient);
      }
      np->state.status |= STAT_ACTIVE;
      activeClient = np;
      if(!(np->state.status & STAT_OPACITY)) {
         SetOpacity(np, settings.activeClientOpacity, 0);
      }

      DrawBorder(np);
      RequirePagerUpdate();
      RequireTaskUpdate();

   }

   if(np->state.status & STAT_MAPPED) {
      UpdateClientColormap(np);
      SetWindowAtom(rootWindow, ATOM_NET_ACTIVE_WINDOW, np->window);
      if(np->state.status & STAT_CANFOCUS) {
         JXSetInputFocus(display, np->window, RevertToParent, eventTime);
      }
      if(np->state.status & STAT_TAKEFOCUS) {
         SendClientMessage(np->window, ATOM_WM_PROTOCOLS, ATOM_WM_TAKE_FOCUS);
      }
   } else {
      JXSetInputFocus(display, rootWindow, RevertToParent, eventTime);
   }

}
Example #13
0
void Game_Event::Setup(RPG::EventPage* new_page) {
	page = new_page;

	// Free resources if needed
	if (interpreter) {
		interpreter->Clear();
		Game_Map::ReserveInterpreterDeletion(interpreter);
		interpreter.reset();
	}

	if (page == NULL) {
		tile_id = 0;
		SetSpriteName("");
		SetSpriteIndex(0);
		SetDirection(RPG::EventPage::Direction_down);
		//move_type = 0;
		trigger = -1;
		list.clear();
		return;
	}
	SetSpriteName(page->character_name);
	SetSpriteIndex(page->character_index);

	tile_id = page->character_name.empty() ? page->character_index : 0;

	if (GetDirection() != page->character_direction) {
		SetDirection(page->character_direction);
		SetSpriteDirection(page->character_direction);
	}

	if (original_pattern != page->character_pattern) {
		pattern = page->character_pattern;
		original_pattern = pattern;
	}
	
	move_type = page->move_type;
	SetMoveSpeed(page->move_speed);
	SetMoveFrequency(page->move_frequency);
	max_stop_count = (GetMoveFrequency() > 7) ? 0 : pow(2.0, 8 - GetMoveFrequency());
	original_move_frequency = page->move_frequency;
	original_move_route = page->move_route;
	SetOriginalMoveRouteIndex(0);
	animation_type = page->animation_type;
	SetOpacity(page->translucent ? 160 : 255);

	SetLayer(page->layer);
	trigger = page->trigger;
	list = page->event_commands;

	if (trigger == RPG::EventPage::Trigger_parallel) {
		interpreter.reset(new Game_Interpreter_Map());
	}
	CheckEventTriggerAuto();
}
void Window_Message::InsertNewPage() {
	// Cancel pending face requests for async
	// Otherwise they render on the wrong page
	face_request_ids.clear();

	contents->Clear();

	y = Game_Message::GetRealPosition() * 80;

	if (Game_Message::IsTransparent()) {
		SetOpacity(0);
	} else {
		SetOpacity(255);
	}

	if (!Game_Message::GetFaceName().empty()) {
		if (!Game_Message::IsFaceRightPosition()) {
			contents_x = LeftMargin + FaceSize + RightFaceMargin;
			DrawFace(Game_Message::GetFaceName(), Game_Message::GetFaceIndex(), LeftMargin, TopMargin, Game_Message::IsFaceFlipped());
		} else {
			contents_x = 0;
			DrawFace(Game_Message::GetFaceName(), Game_Message::GetFaceIndex(), 248, TopMargin, Game_Message::IsFaceFlipped());
		}
	} else {
		contents_x = 0;
	}

	if (Game_Message::choice_start == 0 && Game_Message::choice_max > 0) {
		contents_x += 12;
	}

	contents_y = 2;
	line_count = 0;
	text_color = Font::ColorDefault;
	speed_modifier = 0;

	if (Game_Message::num_input_start == 0 && Game_Message::num_input_variable_id > 0) {
		// If there is an input window on the first line
		StartNumberInputProcessing();
	}
}
Example #15
0
mitk::Material::Material(  )
{
  InitializeStandardValues();
  SetColor( GetColor() );
  SetColorCoefficient( GetColorCoefficient() );
  SetSpecularColor( GetSpecularColor() );
  SetSpecularCoefficient( GetSpecularCoefficient() );
  SetSpecularPower( GetSpecularPower() );
  SetOpacity( GetOpacity() );
  SetInterpolation( GetInterpolation() );
  SetRepresentation( GetRepresentation() );
  SetLineWidth( GetLineWidth() );
}
Example #16
0
mitk::Material::Material( mitk::Material::Color color, vtkFloatingPointType colorCoefficient, vtkFloatingPointType specularCoefficient, vtkFloatingPointType specularPower, vtkFloatingPointType opacity )
{
  InitializeStandardValues();
  SetColor( color );
  SetColorCoefficient( colorCoefficient );
  SetSpecularColor( GetSpecularColor() );
  SetSpecularCoefficient( specularCoefficient );
  SetSpecularPower( specularPower );
  SetOpacity( opacity );
  SetInterpolation( GetInterpolation() );
  SetRepresentation( GetRepresentation() );
  SetLineWidth( GetLineWidth() );
}
Example #17
0
mitk::Material::Material( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType opacity )
{
  InitializeStandardValues();
  SetColor( red, green, blue );
  SetColorCoefficient( GetColorCoefficient() );
  SetSpecularColor( GetSpecularColor() );
  SetSpecularCoefficient( GetSpecularCoefficient() );
  SetSpecularPower( GetSpecularPower() );
  SetOpacity( opacity );
  SetInterpolation( GetInterpolation() );
  SetRepresentation( GetRepresentation() );
  SetLineWidth( GetLineWidth() );
  m_Name = "";
}
Example #18
0
bool CSprite::Init(const std::string& bname, float opacity = 1.0f)
{
	if (bname != m_ImgName)
	{
		return false;
	}
	
	m_ImgName = bname;
	std::wstring wbname = utf8_decode(bname);
	HRESULT hr = g_Graphics.LoadBitmapFromFile(wbname.c_str(), &m_pBitmap);
	
	SetOpacity(opacity);
	return SUCCEEDED(hr);
}
Example #19
0
plLayerDepth::plLayerDepth()
{
    SetZFlags(hsGMatState::kZNoZRead | hsGMatState::kZNoZWrite);
    SetBlendFlags(hsGMatState::kBlendAdd);
    SetMiscFlags(hsGMatState::kMiscRestartPassHere | hsGMatState::kMiscTroubledLoner);

    SetPreshadeColor(hsColorRGBA().Set(0,0,0,1.f));
    SetRuntimeColor(hsColorRGBA().Set(0,0,0,1.f));
    SetAmbientColor(hsColorRGBA().Set(0.1f, 0.1f, 0.1f, 1.f));
    SetOpacity(1.f);

    *fTexture = nil;

}
Example #20
0
mitk::Material::Material( Color color, double opacity )
{
  InitializeStandardValues();
  SetColor( color );
  SetColorCoefficient( GetColorCoefficient() );
  SetSpecularColor( GetSpecularColor() );
  SetSpecularCoefficient( GetSpecularCoefficient() );
  SetSpecularPower( GetSpecularPower() );
  SetOpacity( opacity );
  SetInterpolation( GetInterpolation() );
  SetRepresentation( GetRepresentation() );
  SetLineWidth( GetLineWidth() );
  m_Name = "";
}
Example #21
0
EXPORT_C void CHuiCanvasGc::SetDefaults()
	{
	SetTextStyle(0);
    SetPenColor(TRgb(255,255,255));
	SetPenWidth(1.0);
	SetOpacity(1.0);
	SetPolygonDrawMode(EHuiNoFill);
	SetTextAlign(EHuiAlignHLeft, EHuiAlignVTop);
    SetDrawMode(EHuiCanvasDrawModeBlend);
    EnableEffectiveOpacity(ETrue);    
    SetPolygonFillTexture(NULL);
    SetPolygonFillTextureOrigin(TPoint(0,0));
	CancelClipping();
	}
Example #22
0
void
TruecolorAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("TruecolorAttributes");
    if(searchNode == 0)
        return;

    DataNode *node;
    if((node = searchNode->GetNode("opacity")) != 0)
        SetOpacity(node->AsDouble());
    if((node = searchNode->GetNode("lightingFlag")) != 0)
        SetLightingFlag(node->AsBool());
}
Example #23
0
mitk::Material::Material( double red, double green, double blue,
    double colorCoefficient, double specularCoefficient,
    double specularPower, double opacity )
{
  InitializeStandardValues();
  SetColor( red, green, blue );
  SetColorCoefficient( colorCoefficient );
  SetSpecularColor( GetSpecularColor() );
  SetSpecularCoefficient( specularCoefficient );
  SetSpecularPower( specularPower );
  SetOpacity( opacity );
  SetInterpolation( GetInterpolation() );
  SetRepresentation( GetRepresentation() );
  SetLineWidth( GetLineWidth() );
  m_Name = "";
}
Example #24
0
bool RuntimeSpriteObject::ChangeProperty(std::size_t propertyNb, gd::String newValue)
{
    if ( propertyNb == 0 ) { return SetCurrentAnimation(newValue.To<int>()); }
    else if ( propertyNb == 1 )
    {
        if ( currentAnimation >= GetAnimationsCount() ) return false;

        return animations[currentAnimation].Get().useMultipleDirections ? SetDirection(newValue.To<std::size_t>()) : SetAngle(newValue.To<float>());
    }
    else if ( propertyNb == 2 ) { return SetSprite(newValue.To<int>()); }
    else if ( propertyNb == 3 ) { SetOpacity(newValue.To<float>()); }
    else if ( propertyNb == 4 ) { SetBlendMode(newValue.To<int>()); }
    else if ( propertyNb == 5 ) {SetScaleX(newValue.To<float>());}
    else if ( propertyNb == 6 ) {SetScaleY(newValue.To<float>());}

    return true;
}
Example #25
0
CLayout::CLayout() :
	application_background(false),
	tree(NULL)
{
	Set(640, 480);
	SetColor(RGB(255,255,255));
	SetOpacity(100.0);

	// Layout title
	CString LayoutTitle;
	LayoutTitle.Format("%s 1", LAYOUT);
	m_Name = LayoutTitle;

	objects.InitHashTable(1423);

	m_unboundedScrolling = false;

	scroll_position = CPoint(0, 0);
	m_EventEditorScroll = CPoint(0, 0);

	m_LayoutEditor = NULL;
	application   = 0;
	m_Grid   = false;
	m_SnapMovements = false;
	m_SnapResize = false;
	m_GridWidth = 16;
	m_GridHeight = 16;
	m_ObjectFrameIsLockedTo = 0;
	m_ParentObjectFrameIsLockedTo = 0;

	m_oTemporyBehaviorInfo=0;
	m_pTempMovExt=0;

	m_oControlBehaviorInfo=0;	
	m_pControlBehaviorExt=0;
	m_pControlBehaviorData = 0;
	m_pControlBehaviorDataSize = 0;

	m_unboundedScrolling = false;
	m_bChanged = false;

	hdcTexture = -2;
	hdc = NULL;

	texture_loading = tl_use_app_setting;
}
Example #26
0
bool RuntimeSpriteObject::ChangeProperty(unsigned int propertyNb, std::string newValue)
{
    if ( propertyNb == 0 ) { return SetCurrentAnimation(ToInt(newValue)); }
    else if ( propertyNb == 1 )
    {
        if ( currentAnimation >= GetAnimationsCount() ) return false;

        return animations[currentAnimation].Get().useMultipleDirections ? SetDirection(ToInt(newValue)) : SetAngle(ToFloat(newValue));
    }
    else if ( propertyNb == 2 ) { return SetSprite(ToInt(newValue)); }
    else if ( propertyNb == 3 ) { SetOpacity(ToFloat(newValue)); }
    else if ( propertyNb == 4 ) { SetBlendMode(ToInt(newValue)); }
    else if ( propertyNb == 5 ) {SetScaleX(ToFloat(newValue));}
    else if ( propertyNb == 6 ) {SetScaleY(ToFloat(newValue));}

    return true;
}
void BattleAnimation::DrawAt(int x, int y) {
	if (IsDone()) {
		return;
	}
	if (!GetVisible()) {
		return;
	}

	const RPG::AnimationFrame& anim_frame = animation.frames[frame];

	std::vector<RPG::AnimationCellData>::const_iterator it;
	for (it = anim_frame.cells.begin(); it != anim_frame.cells.end(); ++it) {
		const RPG::AnimationCellData& cell = *it;

		if (!cell.valid) {
			// Skip unused cells (they are created by deleting cells in the
			// animation editor, resulting in gaps)
			continue;
		}

		SetX(cell.x + x);
		SetY(cell.y + y);
		int sx = cell.cell_id % 5;
		int sy = cell.cell_id / 5;
		int size = large ? 128 : 96;
		SetSrcRect(Rect(sx * size, sy * size, size, size));
		SetOx(size / 2);
		SetOy(size / 2);
		SetTone(Tone(cell.tone_red * 128 / 100,
			cell.tone_green * 128 / 100,
			cell.tone_blue * 128 / 100,
			cell.tone_gray * 128 / 100));
		SetOpacity(255 * (100 - cell.transparency) / 100);
		SetZoomX(cell.zoom / 100.0);
		SetZoomY(cell.zoom / 100.0);
		Sprite::Draw();
	}

	if (anim_frame.cells.empty()) {
		// Draw an empty sprite when no cell is available in the animation
		SetSrcRect(Rect(0, 0, 0, 0));
		Sprite::Draw();
	}
}
Window_BattleStatus::Window_BattleStatus(int ix, int iy, int iwidth, int iheight, bool enemy) :
	Window_Selectable(ix, iy, iwidth, iheight), mode(ChoiceMode_All), enemy(enemy) {

	SetBorderX(4);

	SetContents(Bitmap::Create(width - 8, height - 16));

	index = -1;

	if (Data::battlecommands.battle_type == RPG::BattleCommands::BattleType_gauge) {
		// Simulate a borderless window
		// Doing it this way for gauge style makes the implementation on
		// scene-side easier
		border_x = 0;
		border_y = 0;
		SetContents(Bitmap::Create(width, height));
		SetOpacity(0);
	}

	Refresh();
}
void Sprite_AirshipShadow::Update() {
	Sprite::Update();

	if (!Main_Data::game_player->InAirship()) {
		SetVisible(false);
		return;
	}
	SetVisible(true);

	Game_Vehicle* airship = Game_Map::GetVehicle(Game_Vehicle::Airship);

	const int altitude = airship->GetAltitude();
	const int max_altitude = TILE_SIZE;
	const double opacity = (double)altitude / max_altitude;
	SetOpacity(opacity * 255);

	SetX(Main_Data::game_player->GetScreenX());
	SetY(Main_Data::game_player->GetScreenY());
	// Higher than the events in the upper layer
	SetZ(151);
}
ScopeBarIcon::ScopeBarIcon(std::string id_, std::string icon_hint)
  : IconTexture(icon_hint, TEXTURE_SIZE)
  , id(id_)
  , active(false)
  , scale(DEFAULT_SCALE)
  , inactive_opacity_(0.4f)
{
  SetMinMaxSize(FOCUS_OVERLAY_WIDTH.CP(scale()), FOCUS_OVERLAY_HEIGHT.CP(scale()));

  focus_layer_.reset(Style::Instance().FocusOverlay(FOCUS_OVERLAY_WIDTH.CP(scale()), FOCUS_OVERLAY_HEIGHT.CP(scale())));

  SetOpacity(inactive_opacity_);

  SetAcceptKeyNavFocus(true);
  SetAcceptKeyNavFocusOnMouseDown(false);
  SetAcceptKeyNavFocusOnMouseEnter(true);

  active.changed.connect(sigc::mem_fun(this, &ScopeBarIcon::OnActiveChanged));
  scale.changed.connect(sigc::mem_fun(this, &ScopeBarIcon::UpdateScale));
  key_nav_focus_change.connect([this](nux::Area*, bool, nux::KeyNavDirection){ QueueDraw(); });
}