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=""; messageBoxText="";
messageBoxMarker=0; messageBoxMarker=0;
messageBoxLoad=true; messageBoxLoad=true;
printf("Called 2\n");
} else { } else {
messageBoxVisible=false; messageBoxVisible=false;
if (CLOSE_OVERWORLD_WINDOW&&INTERACTION_MESSAGES.size()==0) { 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); target->AddHP(healAmt);
targetText+=target->obj->name+" recovered "+std::to_string(healAmt)+" hitpoints.\n"; targetText+=target->obj->name+" recovered "+std::to_string(healAmt)+" hitpoints.\n";
messageBoxLoad=true; messageBoxLoad=true;
printf("Called 3\n");
messageBoxVisible=true; messageBoxVisible=true;
HEALING_OVERWORLD_MEMBER++; HEALING_OVERWORLD_MEMBER++;
break; 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; MESSAGE_BOX_DIALOG_CHOICES_MADE=0;
} else { } else {
if (MessageBoxAllowedToAdvance()) { if (MessageBoxAllowedToAdvance()) {
printf("In here: %c\n",messageBoxFinalText[messageBoxMarker]);
if (messageBoxFinalText[messageBoxMarker]=='[') { if (messageBoxFinalText[messageBoxMarker]=='[') {
messageBoxMarker++; messageBoxMarker++;
waitingForChoice=true; 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; MESSAGE_BOX_DIALOG_CHOICE_CURSOR=0;
messageBoxMarker++; messageBoxMarker++;
} else } 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 (!waitingForChoice){
if (!insideChoice||insideChoice&&messageBoxFinalText[messageBoxMarker]!='<'&&messageBoxFinalText[messageBoxMarker]!='>') {
messageBoxText+=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) { if (ACTIONKEYPRESSED) {
MESSAGE_BOX_DIALOG_ANSWERS[MESSAGE_BOX_DIALOG_CHOICES_MADE++]=MESSAGE_BOX_DIALOG_CHOICE_CURSOR; MESSAGE_BOX_DIALOG_ANSWERS[MESSAGE_BOX_DIALOG_CHOICES_MADE++]=MESSAGE_BOX_DIALOG_CHOICE_CURSOR;
waitingForChoice=false; 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; goto reset;
} }

Loading…
Cancel
Save