Objects can be created on-demand

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 30f33851f7
commit 4dac804965
  1. 44
      SeasonsOfLoneliness.cpp
  2. BIN
      Seasons_of_Loneliness

@ -122,6 +122,21 @@ class Object{
vi2d spos;
vi2d size;
bool hascut=false;
Object(Decal*spr) {
this->spr=spr;
}
Object(Decal*spr,Animation*anim) {
this->spr=spr;
this->anim=anim;
this->hasAnim=true;
updateAnimationsList.push_back(anim);
}
Object(Decal*spr,vi2d spos,vi2d size) {
this->spr=spr;
this->hascut=true;
this->spos=spos;
this->size=size;
}
};
class ParticleEffect{
@ -1435,7 +1450,7 @@ public:
}
y++;
} else {
Object*obj;
Object*obj = new Object();
std::stringstream split1(data.substr(0,data.find(';')));
split1>>obj->x;
std::stringstream split2(data.substr(data.find(';')+1,data.find(';',data.find(";")+1)-(data.find(';')+1)));
@ -1446,6 +1461,11 @@ public:
if (BASE_OBJECTS[split3]->hasanim) {
obj->hasAnim=true;
obj->anim=BASE_OBJECTS[split3]->anim;
} else
if (BASE_OBJECTS[split3]->hascut){
obj->hascut=true;
obj->spos=BASE_OBJECTS[split3]->spos;
obj->size=BASE_OBJECTS[split3]->size;
}
} else {
obj->spr=NULL;
@ -1775,6 +1795,28 @@ public:
PLAYER_COORDS[0]=teleLoc.x+0.5;
PLAYER_COORDS[1]=teleLoc.y+0.5;
}
Object*createObject(vf2d pos,Decal*spr) {
Object*newobj;
OBJECTS.push_back(newobj=new Object(spr));
newobj->x=pos.x;
newobj->y=pos.y;
return newobj;
}
Object*createObject(vf2d pos,Decal*spr,Animation*anim) {
Object*newobj;
OBJECTS.push_back(newobj=new Object(spr,anim));
newobj->x=pos.x;
newobj->y=pos.y;
return newobj;
}
Object*createObject(vf2d pos,Decal*spr,vi2d spos,vi2d size) {
Object*newobj;
OBJECTS.push_back(newobj=new Object(spr,spos,size));
newobj->x=pos.x;
newobj->y=pos.y;
return newobj;
}
};

Binary file not shown.
Loading…
Cancel
Save