diff --git a/C++ProjectTemplate b/C++ProjectTemplate index 8201a00..76ddf12 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/cutscene.h b/cutscene.h index a8f8af5..e2c7284 100644 --- a/cutscene.h +++ b/cutscene.h @@ -82,6 +82,7 @@ class Cutscene{ int actionMarker=0; std::vector actions; bool actionIsActive=false; + std::vectorcutsceneObjs; public: template Cutscene(std::initializer_list actions) { @@ -117,4 +118,21 @@ class Cutscene{ actionMarker=0; actionIsActive=false; } + Object*AddCutsceneObject(Object*obj) { + this->cutsceneObjs.push_back(obj); + return obj; + } + std::vector GetCutsceneObjects() { + return cutsceneObjs; + } + //Does things like reset cutscene flags and removing objects. + // + //MAKE SURE TO DELETE ALL OBJECTS IN THE OBJECTS WORLD ARRAY BEFORE CALLING THIS! + //THIS FUNCTION WILL DELETE THE POINTERS FOR YOU! + void CleanupCutscene() { + for (int i=0;ispr=spr; this->pos=pos; this->id=id; @@ -88,6 +88,7 @@ class Object{ this->color=color; this->animationSpd=animationSpd; SetScale(scale); + this->temp=temp; } void SetScale(vd2d scale) { this->scale=scale; @@ -266,10 +267,21 @@ goes on a very long time, I hope you can understand this is only for testing pur case ActionType::CREATE_OBJECTS:{ for (auto&obj:((CreateObjects*)CurrentCutscene->GetAction())->GetObjects()) { obj->temp=true; - AddObjectToWorld(obj); + AddObjectToWorld(CurrentCutscene->AddCutsceneObject(new Object(obj->id,obj->name,obj->pos,obj->spr,obj->scale,obj->color,obj->animationSpd,true))); } CurrentCutscene->AdvanceAction(); }break; + case ActionType::CLEANUP:{ + for (int i=0;itemp) { + OBJECTS.erase(OBJECTS.begin()+i--); + } + } + CurrentCutscene->CleanupCutscene(); + CurrentCutscene->ResetCutscene(); + CurrentCutscene=nullptr; + StartCutscene(TestCutscene); + }break; } switch (GAME_STATE) { @@ -1209,13 +1221,6 @@ goes on a very long time, I hope you can understand this is only for testing pur Draw({pos.x,pos.y+size.y-1},Pixel(77, 51, 125)); } - void PlayCutscene(int scene) { - switch (scene) { - case cutscene::TEST_CUTSCENE:{ - }break; - } - } - void StartCutscene(Cutscene*cutscene) { CurrentCutscene=cutscene; }