|
|
|
@ -15,6 +15,7 @@ |
|
|
|
|
#include "battleproperty.h" |
|
|
|
|
#include "map.h" |
|
|
|
|
#include "SeasonI.h" |
|
|
|
|
#include "trigger.h" |
|
|
|
|
|
|
|
|
|
//#include "test/test.h"
|
|
|
|
|
|
|
|
|
@ -190,6 +191,8 @@ std::vector<std::vector<TILE*>> MAP2={}; |
|
|
|
|
std::vector<std::vector<TILE*>> MAP3={}; |
|
|
|
|
std::vector<std::vector<TILE*>> MAP4={}; |
|
|
|
|
std::vector<std::vector<TILE*>> MAP5={}; //Collision Layer
|
|
|
|
|
std::vector<Trigger*> TRIGGERS={}; |
|
|
|
|
std::map<TriggerName::Trigger,Trigger*> Trigger::TRIGGERLIST={}; |
|
|
|
|
std::map<std::string,Decal*> SPRITES; |
|
|
|
|
std::map<std::string,Animation*> ANIMATIONS={}; |
|
|
|
|
std::map<int,Object*> OBJ_INFO={}; |
|
|
|
@ -229,7 +232,6 @@ bool SeasonI::OnUserCreate(){ |
|
|
|
|
SetupObjectInfo(); |
|
|
|
|
SetupEncounters(); |
|
|
|
|
SetupBattleProperties(); |
|
|
|
|
|
|
|
|
|
SetGameFlag(Flag::TEST_FLAG1,false); |
|
|
|
|
SetGameFlag(Flag::TEST_FLAG2,false); |
|
|
|
|
SetGameFlag(Flag::TEST_FLAG3,false); |
|
|
|
@ -791,6 +793,7 @@ void SeasonI::LoadMap(Map*map) { |
|
|
|
|
delete OBJECTS[i]; |
|
|
|
|
} |
|
|
|
|
OBJECTS.clear(); |
|
|
|
|
TRIGGERS.clear(); |
|
|
|
|
for (int i=0;i<4;i++) { |
|
|
|
|
PARTY_MEMBER_OBJ[i]=nullptr; |
|
|
|
|
PARTY_MEMBER_ID[i]=0; |
|
|
|
@ -801,10 +804,13 @@ void SeasonI::LoadMap(Map*map) { |
|
|
|
|
if (MAP_WIDTH==-1) { |
|
|
|
|
MAP_WIDTH=data.length()/2; |
|
|
|
|
} |
|
|
|
|
if (data.find("OBJECT")!=std::string::npos||data.find("ENCOUNTER")!=std::string::npos) { |
|
|
|
|
if (data.find("OBJECT")!=std::string::npos||data.find("ENCOUNTER")!=std::string::npos |
|
|
|
|
||data.find("TRIGGER")!=std::string::npos) { |
|
|
|
|
int marker=data.find_first_of(';'); |
|
|
|
|
int lastMarker=marker; |
|
|
|
|
std::stringstream split1((data.find("OBJECT")!=std::string::npos)?data.substr(6,marker-6):data.substr(9,marker-9)); |
|
|
|
|
std::stringstream split1((data.find("OBJECT")!=std::string::npos)?data.substr(6,marker-6): |
|
|
|
|
(data.find("ENCOUNTER")!=std::string::npos)?data.substr(9,marker-9): |
|
|
|
|
(data.find("TRIGGER")!=std::string::npos)?data.substr(7,marker-7):""); |
|
|
|
|
marker=data.find_first_of(';',marker+1); |
|
|
|
|
std::stringstream split2(data.substr(lastMarker+1,marker-lastMarker-1)); |
|
|
|
|
lastMarker=marker; |
|
|
|
@ -846,6 +852,19 @@ void SeasonI::LoadMap(Map*map) { |
|
|
|
|
LoadEncounter(map,{x,y},pct,id,rand()%100<pct); |
|
|
|
|
|
|
|
|
|
printf("Encounter %d (%d%c) Loaded.\n",id,pct,'%'); |
|
|
|
|
} else
|
|
|
|
|
if (data.find("TRIGGER")!=std::string::npos) { |
|
|
|
|
marker=data.find_first_of(';',marker+1); |
|
|
|
|
std::stringstream split4(data.substr(lastMarker+1,marker-lastMarker-1)); |
|
|
|
|
lastMarker=marker; |
|
|
|
|
int size_x,size_y; |
|
|
|
|
split4>>size_x; |
|
|
|
|
std::stringstream split5(data.substr(lastMarker+1,marker-lastMarker-1)); |
|
|
|
|
lastMarker=marker; |
|
|
|
|
split5>>size_y; |
|
|
|
|
TRIGGERS.push_back(new Trigger({(int)x,(int)y},{size_x,size_y},id)); |
|
|
|
|
map->triggers.push_back(Trigger::TRIGGERLIST[(TriggerName::Trigger)id]); |
|
|
|
|
printf("Trigger %d Loaded.\n",id); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
std::vector<TILE*> tiles; |
|
|
|
@ -968,6 +987,14 @@ void SeasonI::SaveMap(Map*map) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (int i=0;i<map->triggers.size();i++) { |
|
|
|
|
f.put('\n'); |
|
|
|
|
const std::string trigger="TRIGGER"+std::to_string(map->triggers[i]->GetPosX())+";"+std::to_string(map->triggers[i]->GetPosY())+";"+";"+std::to_string(map->triggers[i]->GetID())+std::to_string(map->triggers[i]->GetSizeX())+";"+std::to_string(map->triggers[i]->GetSizeY()); |
|
|
|
|
for (int j=0;j<trigger.length();j++) { |
|
|
|
|
f.put(trigger[j]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
f.close(); |
|
|
|
|
f2.close(); |
|
|
|
|
f3.close(); |
|
|
|
@ -4283,7 +4310,7 @@ std::string SeasonI::Wrap(std::string str,int width,bool proportional,vd2d scale |
|
|
|
|
} else { |
|
|
|
|
word = str.substr(0,str.find(" ")); |
|
|
|
|
} |
|
|
|
|
vi2d newSize = (proportional?GetTextSizeProp(newStr+(newStr.size()>0?" ":"")+word):GetTextSize(newStr+(newStr.size()>0?" ":"")+word))*scale; |
|
|
|
|
vi2d newSize = vd2d(proportional?GetTextSizeProp(newStr+(newStr.size()>0?" ":"")+word):GetTextSize(newStr+(newStr.size()>0?" ":"")+word))*scale; |
|
|
|
|
if (newSize.x>width) { |
|
|
|
|
newStr+="\n"+word; |
|
|
|
|
} else { |
|
|
|
|