summaryrefslogtreecommitdiff
path: root/web/dartboat_wasm.c
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-04-23 03:11:48 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-04-23 03:11:48 -0700
commit71b2f13214405ec43cb1d4e55d32bd7786758e16 (patch)
tree29cec54b74af64b62e572c1ac91b7336935e87cb /web/dartboat_wasm.c
parent39b76b0e432077f9777e66bb1e4d3486db5edbf0 (diff)
downloaddartboat-71b2f13214405ec43cb1d4e55d32bd7786758e16.tar.gz
dartboat-71b2f13214405ec43cb1d4e55d32bd7786758e16.tar.xz
misc web ui cleanup
Diffstat (limited to 'web/dartboat_wasm.c')
-rw-r--r--web/dartboat_wasm.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/web/dartboat_wasm.c b/web/dartboat_wasm.c
index 5a043d1..04d8825 100644
--- a/web/dartboat_wasm.c
+++ b/web/dartboat_wasm.c
@@ -68,7 +68,7 @@ EMSCRIPTEN_KEEPALIVE int is_match_over() {
void match_over() {
EM_ASM({setPromptHandler($0)}, "init");
- EM_ASM({promptSugg($0)}, "Press OK to play again.");
+ EM_ASM({promptMsgR($0)}, "Press OK to play again.");
EM_ASM(setPlayerActive());
}
@@ -114,13 +114,13 @@ EMSCRIPTEN_KEEPALIVE void draw_match() {
}
if (l1->rem <= 0) {
- EM_ASM({promptMsg($0)}, "Darts needed?");
+ EM_ASM({promptMsgL($0)}, "Darts needed?");
EM_ASM({setPromptHandler($0)}, "num_darts");
} else if (l2->rem <= 0) {
- EM_ASM({promptMsg($0)}, "Bot wins. :(");
+ EM_ASM({promptMsgL($0)}, "Bot wins. :(");
match_over();
} else {
- EM_ASM({promptMsg($0)}, "Enter points:");
+ EM_ASM({promptMsgL($0)}, "Enter points:");
}
}
@@ -161,7 +161,7 @@ EMSCRIPTEN_KEEPALIVE void boat_visit() {
if (state->l1->rem <= 0 || state->l2->rem <= 0)
return;
- EM_ASM({promptMsg($0)}, "Bot is throwing…");
+ EM_ASM({promptMsgL($0)}, "Bot is throwing…");
struct leg *l = state->l2;
comp_visit(l);
@@ -220,7 +220,7 @@ EMSCRIPTEN_KEEPALIVE bool user_visit(int points) {
EM_ASM({updatePlayerAvg($0, $1)}, P_USER,
(double)(l->start-l->rem)/l->n_visits);
- EM_ASM({clearMatchLog()});
+ EM_ASM({clearVisits()});
draw_match();
if (!is_match_over()) {
@@ -243,16 +243,16 @@ EMSCRIPTEN_KEEPALIVE void draw_boat_throwing(int pts, char *str) {
int rem = state->l2->n_visits > 1 ? state->l2->visits[state->l2->n_visits-2].rem : state->l2->start;
update_boat_rem(rem - pts);
- EM_ASM({setPromptText($0)}, buf);
- EM_ASM({promptSugg($0)}, str);
+ EM_ASM({setPromptInput($0)}, buf);
+ EM_ASM({promptMsgR($0)}, str);
}
EMSCRIPTEN_KEEPALIVE void end_boat_throwing(int rem, int avg) {
update_boat_rem(rem);
EM_ASM({updatePlayerAvg($0, $1)}, P_BOAT, avg);
- EM_ASM({setPromptText($0)}, "");
- EM_ASM(clearMatchLog());
- EM_ASM({promptSugg($0)}, "");
+ EM_ASM({setPromptInput($0)}, "");
+ EM_ASM(clearVisits());
+ EM_ASM({promptMsgR($0)}, "");
draw_match();
if (!is_match_over())
@@ -269,7 +269,7 @@ EMSCRIPTEN_KEEPALIVE void resp_numdarts(int n_darts) {
EM_ASM({updatePlayerAvg($0, $1)}, P_USER,
((double)l->start / (((l->n_visits - 1) * 3) + n_darts)) * 3);
- EM_ASM({promptMsg($0)}, "You win! :)");
+ EM_ASM({promptMsgL($0)}, "You win! :)");
match_over();
EM_ASM({setPromptHandler($0)}, "init");
}
@@ -307,18 +307,18 @@ EMSCRIPTEN_KEEPALIVE void start_match() {
update_user_rem(state->l1->rem);
update_boat_rem(state->l2->rem);
- EM_ASM(clearMatchLog());
+ EM_ASM(clearVisits());
set_user_active();
- EM_ASM({promptSugg($0)}, "");
+ EM_ASM({promptMsgR($0)}, "");
draw_match();
}
-EMSCRIPTEN_KEEPALIVE void change_stdev(float hstdev, float vstdev) {
+EMSCRIPTEN_KEEPALIVE void set_stdev(float hstdev, float vstdev) {
horizontal_stdev = hstdev;
vertical_stdev = vstdev;
}
-EMSCRIPTEN_KEEPALIVE void change_delay(int delay) {
+EMSCRIPTEN_KEEPALIVE void set_delay(int delay) {
delay_ms = delay;
}