// Command Show choices bool Game_Interpreter::CommandShowChoices(RPG::EventCommand const& com) { // Code ShowChoice if (!Game_Message::texts.empty()) { return false; } Game_Message::message_waiting = true; // Choices setup std::vector<std::string> choices; Game_Message::choice_cancel_type = com.parameters[0]; GetStrings(choices); SetupChoices(choices); return true; }
// Command Show Message bool Game_Interpreter::CommandShowMessage(RPG::EventCommand const& com) { // Code ShowMessage // If there's a text already, return immediately if (!Game_Message::texts.empty()) { return false; } unsigned int line_count = 0; Game_Message::message_waiting = true; Game_Message::owner_id = event_id; // Set first line Game_Message::texts.push_back(com.string); line_count++; for (;;) { // If next event command is the following parts of the message if ( index < list.size() - 1 && list[index+1].code == Cmd::ShowMessage_2 ) { // Add second (another) line line_count++; Game_Message::texts.push_back(list[index+1].string); } else { // If next event command is show choices std::vector<std::string> s_choices; if ( (index < list.size() - 1) && (list[index+1].code == Cmd::ShowChoice) ) { GetStrings(s_choices); // If choices fit on screen if (s_choices.size() <= (4 - line_count)) { index++; Game_Message::choice_start = line_count; Game_Message::choice_cancel_type = list[index].parameters[0]; SetupChoices(s_choices); } } else if ((index < list.size() - 1) && (list[index+1].code == Cmd::InputNumber) ) { // If next event command is input number // If input number fits on screen if (line_count < 4) { index++; Game_Message::num_input_start = line_count; Game_Message::num_input_digits_max = list[index].parameters[0]; Game_Message::num_input_variable_id = list[index].parameters[1]; } } return true; } index++; } // End for }