diff options
-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()); |