diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-04-24 01:10:22 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-04-24 01:10:22 -0700 |
commit | 3aa490e9cce29fd3d95eb0ce57b9744b3ed26516 (patch) | |
tree | abec3b30d4c1dab47c131ed5cb0c37458fbe3bfd /web/dartboat_wasm.c | |
parent | 6d8ae1a15e5c7012529b556b8a4d47e295a70b8a (diff) | |
download | dartboat-3aa490e9cce29fd3d95eb0ce57b9744b3ed26516.tar.gz dartboat-3aa490e9cce29fd3d95eb0ce57b9744b3ed26516.tar.xz |
web: clear match display after match is over
Diffstat (limited to 'web/dartboat_wasm.c')
-rw-r--r-- | web/dartboat_wasm.c | 20 |
1 files changed, 14 insertions, 6 deletions
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()); |