From 3aa490e9cce29fd3d95eb0ce57b9744b3ed26516 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sun, 24 Apr 2022 01:10:22 -0700 Subject: web: clear match display after match is over --- web/dartboat_wasm.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'web') diff --git a/web/dartboat_wasm.c b/web/dartboat_wasm.c index d18cd12..836c87f 100644 --- a/web/dartboat_wasm.c +++ b/web/dartboat_wasm.c @@ -85,12 +85,6 @@ void match_over() { EM_ASM(setPlayerActive()); } -EMSCRIPTEN_KEEPALIVE void match_init() { - EM_ASM({setPromptHandler($0)}, "init"); - EM_ASM({promptMsgR($0)}, ""); - EM_ASM({promptMsgL($0)}, "Select match mode:"); -} - EMSCRIPTEN_KEEPALIVE void draw_match() { struct leg *l1 = state->l1; struct leg *l2 = state->l2; @@ -371,6 +365,20 @@ EMSCRIPTEN_KEEPALIVE void free_match() { state = NULL; } +EMSCRIPTEN_KEEPALIVE void match_init() { + for (int i = 1; i < 3; ++i) { + EM_ASM({updatePlayerName($0, $1)}, i, ""); + EM_ASM({updatePlayerRem($0, $1)}, i, ""); + EM_ASM({updatePlayerSugg($0, $1)}, i, ""); + EM_ASM({updatePlayerAvg($0, $1)}, i, 0); + } + EM_ASM(clearVisits()); + + EM_ASM({setPromptHandler($0)}, "init"); + EM_ASM({promptMsgR($0)}, ""); + EM_ASM({promptMsgL($0)}, "Select match mode:"); +} + EMSCRIPTEN_KEEPALIVE void start_match(int mode) { if (mode != M_PVP && mode != M_PVC && mode != M_P) { EM_ASM(oi()); -- cgit v1.2.3-70-g09d2