Saying nothing cancels dialog

main
Cameron Murphy Reikes 2 years ago
parent a6d8a66bb8
commit 2d144149ff

@ -188,11 +188,18 @@ void begin_text_input(); // called when player engages in dialog, must say somet
// a callback, when 'text backend' has finished making text // a callback, when 'text backend' has finished making text
void end_text_input(char *what_player_said) void end_text_input(char *what_player_said)
{ {
player->state = CHARACTER_IDLE;
#ifdef WEB // hacky #ifdef WEB // hacky
_sapp_emsc_register_eventhandlers(); _sapp_emsc_register_eventhandlers();
#endif #endif
size_t player_said_len = strlen(what_player_said); size_t player_said_len = strlen(what_player_said);
if(player_said_len == 0)
{
// this just means cancel the dialog
}
else
{
Sentence what_player_said_sentence = {0}; Sentence what_player_said_sentence = {0};
assert(player_said_len < ARRLEN(what_player_said_sentence.data)); assert(player_said_len < ARRLEN(what_player_said_sentence.data));
memcpy(what_player_said_sentence.data, what_player_said, player_said_len); memcpy(what_player_said_sentence.data, what_player_said, player_said_len);
@ -215,7 +222,7 @@ void end_text_input(char *what_player_said)
} }
BUFF_APPEND(to_append, what_player_said_sentence); BUFF_APPEND(to_append, what_player_said_sentence);
BUFF_APPEND(to_append, SENTENCE_CONST("NPC response")); BUFF_APPEND(to_append, SENTENCE_CONST("NPC response"));
player->state = CHARACTER_IDLE; }
} }
// keydown needs to be referenced when begin text input, // keydown needs to be referenced when begin text input,

Loading…
Cancel
Save