summaryrefslogtreecommitdiff
path: root/web/web_control.c
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-02 18:40:08 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-02 18:40:08 -0700
commit309a8042a3a84476637ad9c0f6535a1d71369759 (patch)
tree4b36e616ddb13a9d2f3d158c5692142d47527119 /web/web_control.c
parent237359d107c5f8fb3e1f7a3532696eb19a6c56fc (diff)
downloaddartboat-309a8042a3a84476637ad9c0f6535a1d71369759.tar.gz
dartboat-309a8042a3a84476637ad9c0f6535a1d71369759.tar.xz
web: move some stuff around
Diffstat (limited to 'web/web_control.c')
-rw-r--r--web/web_control.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/web/web_control.c b/web/web_control.c
index 4f78d67..6c51167 100644
--- a/web/web_control.c
+++ b/web/web_control.c
@@ -2,6 +2,7 @@
#include "web_match.h"
#include "web_opts.h"
#include "web_prompt.h"
+#include "web_svg.h"
#include "web_ui.h"
#include "comp.h"
@@ -50,6 +51,25 @@ void end_boat_visit(int rem, double avg)
}
EMSCRIPTEN_KEEPALIVE
+void draw_boat_throwing(int pts, char *str, double x, double y)
+{
+ char pts_str[10];
+ sprintf(pts_str, "%d", pts);
+
+ int rem = state->legs[1]->n_visits > 1 ?
+ state->legs[1]->visits[state->legs[1]->n_visits-2].rem :
+ state->legs[1]->start;
+
+ svg_draw_point(x, y);
+ update_player_rem(2, rem - pts);
+ EM_ASM({setPromptInput($0)}, pts_str);
+ EM_ASM({promptMsgR($0)}, str);
+ free(str);
+
+ ui_flush_player_info(2); // FIXME bot hard-coded as player 2
+}
+
+EMSCRIPTEN_KEEPALIVE
void boat_visit()
{
struct leg *l = state->legs[1];