From 71b2f13214405ec43cb1d4e55d32bd7786758e16 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sat, 23 Apr 2022 03:11:48 -0700 Subject: misc web ui cleanup --- web/dartboat_wasm.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'web/dartboat_wasm.c') 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; } -- cgit v1.2.3-70-g09d2