diff --git a/C++ProjectTemplate b/C++ProjectTemplate index 8516c28..906f3c9 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/main.cpp b/main.cpp index b17fce5..8fab58f 100644 --- a/main.cpp +++ b/main.cpp @@ -166,9 +166,13 @@ int EQUIP_ITEM_MENU_CURSOR=0; int EQUIP_ITEM_MENU_OFFSET=0; std::vector EQUIP_ITEM_MENU_CONTENTS={}; std::vector> SHOP_MENU_CONTENTS={}; -std::array MESSAGE_BOX_DIALOG_ANSWERS={}; -std::array MESSAGE_BOX_CHOICE_LIST={"","",""}; +std::array MESSAGE_BOX_DIALOG_ANSWERS={-1}; +int MESSAGE_BOX_DIALOG_CHOICES_MADE=0; +std::vector MESSAGE_BOX_CHOICE_LIST={}; bool waitingForChoice=false; +int MESSAGE_BOX_DIALOG_CHOICE_CURSOR=0; +bool insideChoice=false; +bool selectionMade=false; /* [Choice1,Choice2,Choice3] @@ -188,6 +192,10 @@ void DisplayMessageBox(std::string targetT) { messageBoxMarker=0; messageBoxStartMarker=0; messageBoxStopMarker=0; + for (int i=0;iAddHP(healAmt); targetText+=target->obj->name+" recovered "+std::to_string(healAmt)+" hitpoints.\n"; messageBoxLoad=true; + printf("Called 3\n"); messageBoxVisible=true; HEALING_OVERWORLD_MEMBER++; break; @@ -424,13 +434,14 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), targetText+="But it failed."; } messageBoxLoad=true; + printf("Called 4\n"); messageBoxVisible=true; HEALING_OVERWORLD_SINGLE_MEMBER=false; castingMember->selectedMove=nullptr; } } } else { - while (messageBoxMarker') { + messageBoxMarker++; + int counter=0; + if (messageBoxFinalText[messageBoxMarker]-'0'==MESSAGE_BOX_DIALOG_CHOICE_CURSOR) { + messageBoxMarker+=2; + insideChoice=true; + } else { + while(messageBoxFinalText[messageBoxMarker]!='>'&&messageBoxFinalText[messageBoxMarker]!='<') { + messageBoxMarker++; + } + } + } else + if (!waitingForChoice){ + if (!insideChoice||insideChoice&&messageBoxFinalText[messageBoxMarker]!='<'&&messageBoxFinalText[messageBoxMarker]!='>') { + messageBoxText+=messageBoxFinalText[messageBoxMarker++]; + } else + if (messageBoxFinalText[messageBoxMarker]=='<') { + messageBoxMarker++; + } } } } @@ -763,6 +803,29 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), KEY_LASTPRESSED=NONE; } + if (waitingForChoice) { + if (UpPressed()) { + MESSAGE_BOX_DIALOG_CHOICE_CURSOR--; + if (MESSAGE_BOX_DIALOG_CHOICE_CURSOR<0) { + MESSAGE_BOX_DIALOG_CHOICE_CURSOR=MESSAGE_BOX_CHOICE_LIST.size()-1; + } + if (MESSAGE_BOX_DIALOG_CHOICE_CURSOR==0) { + KEY_LASTPRESSED=NONE; + } + } + if (DownPressed()) { + MESSAGE_BOX_DIALOG_CHOICE_CURSOR=(MESSAGE_BOX_DIALOG_CHOICE_CURSOR+1)%MESSAGE_BOX_CHOICE_LIST.size(); + if (MESSAGE_BOX_DIALOG_CHOICE_CURSOR==MESSAGE_BOX_CHOICE_LIST.size()-1) { + KEY_LASTPRESSED=NONE; + } + } + if (ACTIONKEYPRESSED) { + MESSAGE_BOX_DIALOG_ANSWERS[MESSAGE_BOX_DIALOG_CHOICES_MADE++]=MESSAGE_BOX_DIALOG_CHOICE_CURSOR; + waitingForChoice=false; + } + goto reset; + } + if (BATTLE_ENCOUNTER!=nullptr&&!messageBoxVisible) { switch (BATTLE_STATE) { case BattleState::SELECT_ACTION:{ @@ -1727,6 +1790,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), } }break; } + reset: ANYKEYPRESSED=ACTIONKEYPRESSED=false; if (KEY_LASTPRESSED!=NONE) { lastRepeatedFrame=frameCount; @@ -2249,6 +2313,13 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), if (messageBoxVisible) { DrawDialogBox({1,1},{WIDTH/2,HEIGHT/4},Pixel(70, 33, 105,220),Pixel(62, 54, 69,220),Pixel(185, 148, 255,220)); DrawStringPropDecal({6,6},messageBoxText); + if (waitingForChoice) { + DrawDialogBox({1,1+HEIGHT/4},{WIDTH/3,(int)MESSAGE_BOX_CHOICE_LIST.size()*12+4},Pixel(70, 33, 105,220),Pixel(62, 54, 69,220),Pixel(185, 148, 255,220)); + for (int i=0;irender(this); @@ -4676,6 +4747,10 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"), } return 1; } + + bool MessageBoxAllowedToAdvance() { + return messageBoxMarker> itemList; - std::string welcomeMessage="Welcome! Please choose an option: [BUY,SELL]"; + std::string welcomeMessage="Welcome! Please choose an option: [BUY,SELL]>0:Please take a look through our wares.>1:What would you like to sell?<"; Interaction Interact()override{ return {{welcomeMessage}}; }