From ce746742ddf3eb4e101a7220a3306128167c2df1 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 3 Mar 2025 22:06:44 +0100 Subject: [PATCH] rogueviz::seuphorica:: display and cast spells --- rogueviz/seuphorica.cpp | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/rogueviz/seuphorica.cpp b/rogueviz/seuphorica.cpp index 6ed9f9cf..c28cc74f 100644 --- a/rogueviz/seuphorica.cpp +++ b/rogueviz/seuphorica.cpp @@ -77,8 +77,8 @@ string fix(string s) { return s; } -int hold_mode; /* 1 = from board, 2 = from set, 3 = drag size */ -const tile *tile_moved; +int hold_mode; /* 1 = from board, 2 = from set, 3 = drag size, 4 = spell drag */ +tile *tile_moved; vector* box_moved; int tile_boxid; cell *tile_moved_from; @@ -92,7 +92,7 @@ struct wider { }; /** for tiles on the map, only (V,t,c) are defined; for tiles in boxes, (V,t,origbox,boxid) are defined */ -void render_tile(const shiftmatrix& V, const tile& t, cell *c, vector* origbox, int boxid) { +void render_tile(const shiftmatrix& V, tile& t, cell *c, vector* origbox, int boxid) { auto pt0 = [&] (int id, ld r) { if(c) return currentmap->get_corner(c, id+1, r); @@ -191,6 +191,13 @@ void render_tile(const shiftmatrix& V, const tile& t, cell *c, vector* ori tile_moved = &t; box_moved = origbox; tile_boxid = boxid; }); } + if(mousex >= h1[0] && mousex <= h2[0] && mousey >= h1[1] && mousey <= h2[1] && holdmouse && hold_mode == 4) { + if(origbox == &drawn && hold_mode == 4 && holdmouse) { + mouseovers = "cast " + spell_desc(tile_boxid, -1) + " on: " + fix(tile_desc(t)); + tile_moved = &t; + } + else mouseovers = "can cast spells only on tiles in hand"; + } } } @@ -339,6 +346,11 @@ void seuphorica_screen() { if(holdmouse && hold_mode == 3) *drag_what = mousey; + if(holdmouse && hold_mode == 4) { + displaystr(mousex, mousey, 0, vid.fsize, spells[tile_boxid].greek, spells[tile_boxid].color_value, 8); + tile_moved = nullptr; + } + ui.x0 = vid.xres - dialog::dwidth; ui.x2 = vid.xres; ui.x1 = lerp(ui.x0, ui.x2, .5); int ymax = vid.yres - 2 * vid.fsize; ui.y0 = 2 * vid.fsize; @@ -383,16 +395,28 @@ void seuphorica_screen() { quickqueue(); } + int in_row = (isize(spells) + 1) / 2; + for(int id=0; idid] = eupoint(mousex, mousey); if(box_moved == &shop && current_box == &drawn) {