summaryrefslogtreecommitdiff
path: root/web/dartboat_wasm.c
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-04-24 00:56:19 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-04-24 00:56:19 -0700
commit5c855b503ea7e6d90129ac76db2c35c73b61cc34 (patch)
tree324944562cddc583e2d4d2f3d6f441971f1a0d5d /web/dartboat_wasm.c
parentffcf6b76ce72f6080c99b124d1f1b4b23c1ee6e4 (diff)
downloaddartboat-5c855b503ea7e6d90129ac76db2c35c73b61cc34.tar.gz
dartboat-5c855b503ea7e6d90129ac76db2c35c73b61cc34.tar.xz
web: add one-player scoreboard mode
Diffstat (limited to 'web/dartboat_wasm.c')
-rw-r--r--web/dartboat_wasm.c11
1 files changed, 8 insertions, 3 deletions
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 <emscripten/emscripten.h>
-#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;