From 5c855b503ea7e6d90129ac76db2c35c73b61cc34 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sun, 24 Apr 2022 00:56:19 -0700 Subject: web: add one-player scoreboard mode --- web/dartboat_wasm.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'web/dartboat_wasm.c') diff --git a/web/dartboat_wasm.c b/web/dartboat_wasm.c index 5aa38bc..ceed714 100644 --- a/web/dartboat_wasm.c +++ b/web/dartboat_wasm.c @@ -8,8 +8,9 @@ #include -#define M_PVC 1 +#define M_P 1 #define M_PVP 2 +#define M_PVC 3 int delay_ms = 1000; @@ -255,7 +256,7 @@ EMSCRIPTEN_KEEPALIVE bool user_visit(int points) { if (state->mode == M_PVC) { set_boat_active(); boat_visit(); - } else { + } else if (state->mode == M_PVP) { switch_active_user(); } } @@ -368,7 +369,7 @@ EMSCRIPTEN_KEEPALIVE void free_match() { } EMSCRIPTEN_KEEPALIVE void start_match(int mode) { - if (mode != M_PVP && mode != M_PVC) { + if (mode != M_PVP && mode != M_PVC && mode != M_P) { EM_ASM(oi()); return; } @@ -385,6 +386,10 @@ 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()); state->active_p = 1; state->active_l = state->l1; -- cgit v1.2.3-70-g09d2