From 309a8042a3a84476637ad9c0f6535a1d71369759 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Mon, 2 May 2022 18:40:08 -0700 Subject: web: move some stuff around --- web/web_control.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'web/web_control.c') 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" @@ -49,6 +50,25 @@ void end_boat_visit(int rem, double avg) handle_next(); } +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() { -- cgit v1.2.3-70-g09d2