diff --git a/C++ProjectTemplate b/C++ProjectTemplate index fa9b600..3401795 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/assets/maps/map0 b/assets/maps/map0 index 0bed90f..8f59220 100644 --- a/assets/maps/map0 +++ b/assets/maps/map0 @@ -53,15 +53,16 @@ OBJECT224.000000;128.000000;8 OBJECT160.000000;128.000000;8 OBJECT192.000000;128.000000;8 OBJECT288.000000;128.000000;8 +OBJECT313.000000;151.000000;8 OBJECT313.000000;131.000000;10 OBJECT192.000000;160.000000;8 OBJECT160.000000;160.000000;8 OBJECT256.000000;160.000000;8 OBJECT224.000000;160.000000;7 OBJECT288.000000;160.000000;7 +OBJECT123.000000;163.000000;0 OBJECT313.000000;136.000000;11 OBJECT313.000000;141.000000;12 -OBJECT313.000000;151.000000;8 OBJECT288.000000;160.000000;9 OBJECT224.000000;160.000000;9 OBJECT160.000000;192.000000;8 @@ -74,12 +75,11 @@ OBJECT160.000000;224.000000;8 OBJECT288.000000;224.000000;8 OBJECT224.000000;224.000000;8 OBJECT256.000000;224.000000;7 -OBJECT212.000000;228.000000;0 OBJECT288.000000;256.000000;8 OBJECT256.000000;256.000000;8 OBJECT224.000000;256.000000;8 OBJECT192.000000;256.000000;8 OBJECT160.000000;256.000000;8 -ENCOUNTER64;64;90;0 -ENCOUNTER64;256;90;1 -ENCOUNTER64;512;90;2 \ No newline at end of file +ENCOUNTER64.000000;64.000000;90;0 +ENCOUNTER64.000000;256.000000;90;1 +ENCOUNTER64.000000;512.000000;90;2 \ No newline at end of file diff --git a/assets/maps/map0_5 b/assets/maps/map0_5 index 2e36d1a..35d7a48 100644 --- a/assets/maps/map0_5 +++ b/assets/maps/map0_5 @@ -4,7 +4,7 @@ ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? -???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? +??????????0717?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? diff --git a/battlemoves.cpp b/battlemoves.cpp new file mode 100644 index 0000000..3b019d0 --- /dev/null +++ b/battlemoves.cpp @@ -0,0 +1 @@ +#include "battlemoves.h" diff --git a/battlemoves.h b/battlemoves.h new file mode 100644 index 0000000..d826cf0 --- /dev/null +++ b/battlemoves.h @@ -0,0 +1,8 @@ +#include +#include +#include +#include + +#ifndef BATTLEMOVES_H +#define BATTLEMOVES_H +#endif \ No newline at end of file diff --git a/main.cpp b/main.cpp index 731beac..80baf1f 100644 --- a/main.cpp +++ b/main.cpp @@ -77,6 +77,7 @@ class Object{ Flag enableFlag=Flag::NONE; int objArrElement; //Which element in the object array this object is located in. For sorting purposes. bool temp=false; //If set to true, it's marked for deletion after cutscene handling. + bool enc=false; //If set to true, it's not included in the main list of entities for map saving because it's from an encounter. //animationSpd is how long to wait before switching frames. bool Collision(vd2d pos) { GAME->SetDrawTarget(layer::COLLISION); @@ -293,6 +294,7 @@ class Encounter{ int chance; //Chance of the encounter existing. std::vectorobjs; std::array playerPos; + int id; Encounter(vd2d pos,std::array playerPos,std::vectorobjs,int chance=25) :pos(pos),objs(objs),chance(chance),playerPos(playerPos){} }; @@ -496,10 +498,6 @@ goes on a very long time, I hope you can understand this is only for testing pur CurrentCutscene->LockAction(); } - if (!GetGameFlag(Flag::TEST_FLAG1)) { - StartCutscene(TestCutscene); - } - switch (CurrentAction) { case ActionType::SET_FLAG_WHEN_CUTSCENE_ENDS:{ CurrentCutscene->SetupEndingCutsceneFlag(((SetFlagWhenCutsceneEnds*)CurrentCutscene->GetAction())->GetCutsceneEndingFlag(),((SetFlagWhenCutsceneEnds*)CurrentCutscene->GetAction())->GetCutsceneEndingVal()); @@ -908,11 +906,11 @@ goes on a very long time, I hope you can understand this is only for testing pur DrawGameWorld(); SetDrawTarget(nullptr); DrawRectDecal((HIGHLIGHTED_TILE)*32-cameraPos,{32,32},YELLOW); - /*if (EDITING_LAYER==layer::OBJECT) { + if (EDITING_LAYER==layer::OBJECT) { DrawStringPropDecal({2,2},"Editing Objects"); } else { DrawStringPropDecal({2,2},"Editing Layer "+std::to_string(EDITING_LAYER)); - }*/ + } }break; case GameState::TILE_SELECT:{ //14x14 pixels per tile. @@ -1075,7 +1073,7 @@ goes on a very long time, I hope you can understand this is only for testing pur if (data.find("OBJECT")!=std::string::npos||data.find("ENCOUNTER")!=std::string::npos) { int marker=data.find_first_of(';'); int lastMarker=marker; - std::stringstream split1(data.substr(6,marker-6)); + std::stringstream split1((data.find("OBJECT")!=std::string::npos)?data.substr(6,marker-6):data.substr(9,marker-9)); marker=data.find_first_of(';',marker+1); std::stringstream split2(data.substr(lastMarker+1,marker-lastMarker-1)); lastMarker=marker; @@ -1114,12 +1112,7 @@ goes on a very long time, I hope you can understand this is only for testing pur int pct=id; split4>>id; - if (rand()%100temp||OBJECTS[i]->enc) { + continue; + } + if (!allowed) { + continue; + } f.put('\n'); const std::string obj="OBJECT"+std::to_string(OBJECTS[i]->GetPos().x)+";"+std::to_string(OBJECTS[i]->GetPos().y)+";"+std::to_string(OBJECTS[i]->id); - for (int i=0;iencounters.size();i++) { + f.put('\n'); + const std::string enc="ENCOUNTER"+std::to_string(map->encounters[i]->pos.x)+";"+std::to_string(map->encounters[i]->pos.y)+";"+std::to_string(map->encounters[i]->chance)+";"+std::to_string(map->encounters[i]->id); + for (int j=0;j{vd2d @@ -1710,8 +1723,7 @@ goes on a very long time, I hope you can understand this is only for testing pur MOVELIST[BattleMoveName::TESTMOVE2], MOVELIST[BattleMoveName::TESTMOVE3], }), - } - ,chance); + }); }break; case encounter::ENCOUNTER_3:{ data=new Encounter(pos,std::array{vd2d @@ -1724,16 +1736,25 @@ goes on a very long time, I hope you can understand this is only for testing pur MOVELIST[BattleMoveName::TESTMOVE2], MOVELIST[BattleMoveName::TESTMOVE3], }), - } - ,chance); + }); }break; default:{ printf("WARNING! Dead encounter found! THIS SHOULD NOT BE HAPPENING!"); } } + data->chance=chance; + data->id=id; + for (int i=0;iobjs.size();i++) { + data->objs[i]->obj->enc=true; + if (!successful) { + data->objs[i]->HP=0; + } + } map->encounters.push_back(data); for (int i=0;iobjs.size();i++) { - AddObjectToWorld(data->objs[i]->obj); + if (successful) { + AddObjectToWorld(data->objs[i]->obj); + } } }