diff --git a/C++ProjectTemplate b/C++ProjectTemplate index d413ea6..f71260a 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/assets/maps/map0 b/assets/maps/map0 index ec6afa9..7aecd45 100644 --- a/assets/maps/map0 +++ b/assets/maps/map0 @@ -69,6 +69,7 @@ OBJECT256.000000;192.000000;8 OBJECT288.000000;192.000000;8 OBJECT224.000000;192.000000;8 OBJECT192.000000;192.000000;7 +OBJECT352.000000;192.000000;159 OBJECT192.000000;224.000000;8 OBJECT160.000000;224.000000;8 OBJECT288.000000;224.000000;8 @@ -79,9 +80,9 @@ OBJECT256.000000;256.000000;8 OBJECT224.000000;256.000000;8 OBJECT192.000000;256.000000;8 OBJECT160.000000;256.000000;8 +OBJECT322.000000;255.000000;0 OBJECT256.000000;288.000000;90 OBJECT128.000000;288.000000;90 -OBJECT322.000000;288.000000;0 OBJECT192.000000;320.000000;90 OBJECT96.000000;320.000000;90 OBJECT160.000000;384.000000;90 diff --git a/main.cpp b/main.cpp index 1934e1b..5d7525a 100644 --- a/main.cpp +++ b/main.cpp @@ -149,6 +149,8 @@ public: std::vector BATTLE_SPOILS_LIST; std::wstring BATTLE_SPOILS_MESSAGE; int OVERWORLD_MENU_SELECTION=0; + std::vector INTERACTION_MESSAGES; + bool CLOSE_OVERWORLD_WINDOW=false; //When set to true, should cause the overworld menu to close as well once the dialog box is closed. bool MOUSE_PRESSED_DOWN=false,MOUSE_DOWN=false,MOUSE_RELEASED=false; //TODO Implement Mouse things. @@ -299,6 +301,10 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), messageBoxLoad=true; } else { messageBoxVisible=false; + if (CLOSE_OVERWORLD_WINDOW) { + GAME_STATE=GameState::GAME_WORLD; + } + CLOSE_OVERWORLD_WINDOW=false; } } else { while (messageBoxMarker0) { + DisplayMessageBox(INTERACTION_MESSAGES.front()); + INTERACTION_MESSAGES.erase(INTERACTION_MESSAGES.begin()); + } + for (int i=0;itimer>0) { @@ -1031,6 +1042,53 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), OVERWORLD_MENU_SELECTION+=5; } } + if (ACTIONKEYPRESSED) { + switch (OVERWORLD_MENU_SELECTION) { + case 0:{//Check is selected. + Object*closest=nullptr; + float closestDist=999999; + for (int i=0;iGetPos().x-OBJECTS[i]->GetPos().x)+abs(PARTY_MEMBER_OBJ[0]->GetPos().y-OBJECTS[i]->GetPos().y); + if (distInteract(); + if (interaction.messages.size()>0) { + INTERACTION_MESSAGES=interaction.messages; + DisplayMessageBox(INTERACTION_MESSAGES.front()); + INTERACTION_MESSAGES.erase(INTERACTION_MESSAGES.begin()); + } else { + DisplayMessageBox("No problem here."); + } + CLOSE_OVERWORLD_WINDOW=true; + } + }break; + case 1:{//Power is selected. + + }break; + case 2:{//Items is selected. + + }break; + case 3:{//Equip is selected. + + }break; + case 4:{//Status is selected. + + }break; + } + } }break; case GameState::EDITOR:{ if (IsTextEntryEnabled()) { diff --git a/object.h b/object.h index 1cb5e48..a34aea9 100644 --- a/object.h +++ b/object.h @@ -5,8 +5,15 @@ #include "animation.h" #include "defines.h" #include "layers.h" +#include "item.h" using namespace olc; +struct Interaction{ + std::vector messages={}; + Item*item=nullptr; + Flag flag=Flag::NONE; +}; + class Object{ private: vd2d scale={1,1}; @@ -49,7 +56,8 @@ class Object{ this->temp=temp; } virtual Object* CreateType(int id,std::string name,vd2d pos,Animation*spr,vd2d scale={1,1},Pixel color=WHITE,int animationSpd=1,bool temp=false)=0; - virtual bool Interact()=0; + //When the player tries to interact with this object. + virtual Interaction Interact()=0; void SetScale(vd2d scale) { this->scale=scale; if (spr!=nullptr) { @@ -162,11 +170,13 @@ class Object{ class Standard_Obj : public Object{ DynamicObject(Standard_Obj) - bool Interact()override{return false;} + Interaction Interact()override{return {};} }; class TrashCan_Obj : public Object{ DynamicObject(TrashCan_Obj) - bool Interact()override{return false;} + Interaction Interact()override{ + frameIndex=1; + return {{"You dig around the trash can.","Nope! Just looks like good ol' trash."}};} }; #endif \ No newline at end of file