void Validate() override { if (Validated) return; Layer0 = std::make_shared<Sprite>(); LayerMiss = std::make_shared<Sprite>(); Layer1 = std::make_shared<Sprite>(); Layer2 = std::make_shared<Sprite>(); Layer0->ChainTransformation(&Transform); LayerMiss->ChainTransformation(&Transform); Layer1->ChainTransformation(&Transform); Layer2->ChainTransformation(&Transform); Layer0->SetZ(0); Layer1->SetZ(0); LayerMiss->SetZ(0); Layer2->SetZ(0); Layer1->BlackToTransparent = Layer2->BlackToTransparent = BlackToTransparent; LayerMiss->SetImage(List.GetFromIndex(0), false); Layer0->SetImage(List.GetFromIndex(1), false); sort(EventsLayer0.begin(), EventsLayer0.end()); sort(EventsLayerMiss.begin(), EventsLayerMiss.end()); sort(EventsLayer1.begin(), EventsLayer1.end()); sort(EventsLayer2.begin(), EventsLayer2.end()); // Add BMP 0 as default value for layer 0. I was opting for a // if() at SetLayerImage time, but we're microoptimizing for branch mishits. if (EventsLayerMiss.size() == 0 || (EventsLayerMiss.size() > 0 && EventsLayerMiss[0].Time > 0)) { AutoplayBMP bmp; bmp.Time = 0; bmp.BMP = 0; EventsLayerMiss.push_back(bmp); } Transform.SetWidth(256); Transform.SetHeight(256); Validated = true; }
void Validate() override { if (!Background) { auto pt = List.GetFromIndex(0); Background = std::make_shared<Sprite>(); Background->SetImage(pt, false); Background->ChainTransformation(&Transform); Transform.SetWidth(pt ? pt->w : 0); Transform.SetHeight(pt ? pt->h : 0); } }