diff options
Diffstat (limited to 'web/dartboat_wasm.c')
-rw-r--r-- | web/dartboat_wasm.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/web/dartboat_wasm.c b/web/dartboat_wasm.c index 836c87f..1f81b1c 100644 --- a/web/dartboat_wasm.c +++ b/web/dartboat_wasm.c @@ -90,13 +90,16 @@ EMSCRIPTEN_KEEPALIVE void draw_match() { struct leg *l2 = state->l2; char visit_no[10], u_pts[10], u_rem[10], b_pts[10], b_rem[10], b_darts[100]; - visit_no[0] = u_pts[0] = u_rem[0] = b_pts[0] = b_rem[0] = b_darts[0] = 0; + sprintf(u_rem, "%d", l1->start); + sprintf(b_rem, "%d", l2->start); EM_ASM({drawVisit($0, $1, $2, $3, $4, $5)}, - "0", "", "501", "", "501", ""); + "0", "", u_rem, "", state->mode == M_P ? "" : b_rem, ""); int n_visits = l1->n_visits > l2->n_visits ? l1->n_visits : l2->n_visits; for (int i = 0; i < n_visits; ++i) { + visit_no[0] = u_pts[0] = u_rem[0] = b_pts[0] = b_rem[0] = b_darts[0] = 0; + sprintf(visit_no, "%d", i + 1); struct visit *v = l1->visits + i; @@ -117,13 +120,6 @@ EMSCRIPTEN_KEEPALIVE void draw_match() { EM_ASM({drawVisit($0, $1, $2, $3, $4, $5)}, visit_no, u_pts, u_rem, b_pts, b_rem, b_darts); - - visit_no[0] = 0; - u_pts[0] = 0; - u_rem[0] = 0; - b_pts[0] = 0; - b_rem[0] = 0; - b_darts[0] = 0; } if (l1->rem <= 0) { @@ -367,6 +363,7 @@ EMSCRIPTEN_KEEPALIVE void free_match() { EMSCRIPTEN_KEEPALIVE void match_init() { for (int i = 1; i < 3; ++i) { + EM_ASM({hidePlayerInfo($0)}, i); EM_ASM({updatePlayerName($0, $1)}, i, ""); EM_ASM({updatePlayerRem($0, $1)}, i, ""); EM_ASM({updatePlayerSugg($0, $1)}, i, ""); @@ -397,10 +394,9 @@ EMSCRIPTEN_KEEPALIVE void start_match(int mode) { state->l1 = leg_init(501, "Player 1"); state->l2 = leg_init(501, "Player 2"); } - if (mode == M_P) - EM_ASM(hidePlayer2()); - else - EM_ASM(unhidePlayer2()); + EM_ASM({showPlayerInfo($0)}, 1); + if (mode != M_P) + EM_ASM({showPlayerInfo($0)}, 2); state->active_p = 1; state->active_l = state->l1; |