Dialog choices now work

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 4483444dd9
commit 1877bd793f
  1. BIN
      C++ProjectTemplate
  2. 37
      main.cpp

Binary file not shown.

@ -386,7 +386,6 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
messageBoxText="";
messageBoxMarker=0;
messageBoxLoad=true;
printf("Called 2\n");
} else {
messageBoxVisible=false;
if (CLOSE_OVERWORLD_WINDOW&&INTERACTION_MESSAGES.size()==0) {
@ -408,7 +407,6 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
target->AddHP(healAmt);
targetText+=target->obj->name+" recovered "+std::to_string(healAmt)+" hitpoints.\n";
messageBoxLoad=true;
printf("Called 3\n");
messageBoxVisible=true;
HEALING_OVERWORLD_MEMBER++;
break;
@ -709,7 +707,6 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
MESSAGE_BOX_DIALOG_CHOICES_MADE=0;
} else {
if (MessageBoxAllowedToAdvance()) {
printf("In here: %c\n",messageBoxFinalText[messageBoxMarker]);
if (messageBoxFinalText[messageBoxMarker]=='[') {
messageBoxMarker++;
waitingForChoice=true;
@ -733,25 +730,8 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
MESSAGE_BOX_DIALOG_CHOICE_CURSOR=0;
messageBoxMarker++;
} else
if (messageBoxFinalText[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++;
}
}
}
}
@ -822,6 +802,23 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
if (ACTIONKEYPRESSED) {
MESSAGE_BOX_DIALOG_ANSWERS[MESSAGE_BOX_DIALOG_CHOICES_MADE++]=MESSAGE_BOX_DIALOG_CHOICE_CURSOR;
waitingForChoice=false;
std::string responseText="";
if (messageBoxFinalText[messageBoxMarker]=='>') {
messageBoxMarker++;
int counter=0;
while (messageBoxFinalText[messageBoxMarker]-'0'!=MESSAGE_BOX_DIALOG_CHOICE_CURSOR) {
while(messageBoxFinalText[messageBoxMarker]!='>'&&messageBoxFinalText[messageBoxMarker]!='<') {
messageBoxMarker++;
}
messageBoxMarker++;
}
messageBoxMarker+=2;
}
while (messageBoxFinalText[messageBoxMarker]!='<'&&messageBoxFinalText[messageBoxMarker]!='>') {
responseText+=messageBoxFinalText[messageBoxMarker++];
}
DisplayMessageBox("");
targetText=responseText;
}
goto reset;
}

Loading…
Cancel
Save