|
|
|
@ -71,7 +71,7 @@ public: |
|
|
|
|
std::vector<std::vector<TILE*>> MAP; |
|
|
|
|
std::map<Reference,Decal*> SPRITES; |
|
|
|
|
std::map<Reference,Animation*> ANIMATIONS; |
|
|
|
|
std::map<Reference,Object*> OBJ_INFO; |
|
|
|
|
std::map<int,Object*> OBJ_INFO; |
|
|
|
|
std::vector<Object*> OBJECTS; |
|
|
|
|
|
|
|
|
|
bool OnUserCreate() override |
|
|
|
@ -87,7 +87,7 @@ public: |
|
|
|
|
|
|
|
|
|
//OBJ_INFO["PLAYER"]=PLAYER_ANIMATION;
|
|
|
|
|
|
|
|
|
|
//LoadMap(MAP_ONETT);
|
|
|
|
|
LoadMap(MAP_ONETT); |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
@ -136,9 +136,33 @@ public: |
|
|
|
|
MAP_WIDTH=data.length(); |
|
|
|
|
printf("Map Width: %d\n",MAP_WIDTH); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
MAP_HEIGHT++; |
|
|
|
|
if (data.find("OBJECT")!=std::string::npos) { |
|
|
|
|
int marker=data.find_first_of(';'); |
|
|
|
|
int lastMarker=marker; |
|
|
|
|
std::stringstream split1(data.substr(6,marker-6)); |
|
|
|
|
marker=data.find_first_of(';',marker+1); |
|
|
|
|
std::stringstream split2(data.substr(lastMarker+1,marker-lastMarker-1)); |
|
|
|
|
lastMarker=marker; |
|
|
|
|
marker=data.find_first_of(';',marker+1); |
|
|
|
|
std::stringstream split3(data.substr(lastMarker+1,marker-lastMarker-1)); |
|
|
|
|
lastMarker=marker; |
|
|
|
|
|
|
|
|
|
double x,y; |
|
|
|
|
|
|
|
|
|
split1>>x; |
|
|
|
|
split2>>y; |
|
|
|
|
|
|
|
|
|
int id; |
|
|
|
|
split3>>id; |
|
|
|
|
|
|
|
|
|
Object*newObj = new Object(OBJ_INFO[id]->name,{x,y},OBJ_INFO[id]->spr); |
|
|
|
|
OBJECTS.push_back(newObj); |
|
|
|
|
//printf("Object: %s %s %s\n",split1.c_str(),split2.c_str(),split3.c_str());
|
|
|
|
|
} else { |
|
|
|
|
MAP_HEIGHT++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
printf("Loaded map %s.\n",map->filename.c_str()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SetupAnimations() { |
|
|
|
|