#line 1 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl" #include #include "gui/dnd_events.hpp" #include #include "gui/guecstra.hpp" #include "gui/uisystems.hpp" #include #include "gui/status_ui.hpp" #include "gui/loot_ui.hpp" #include "gui/event_router.hpp" #line 95 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl" #line 15 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.cpp" static const int DNDLoot_start = 1; static const int DNDLoot_first_final = 6; static const int DNDLoot_error = 0; static const int DNDLoot_en_main = 1; static const int DNDLoot_en_main_looting = 2; #line 98 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl" namespace gui { class DNDLoot2 { public: std::optional $grab_source = std::nullopt; StatusUI& $status_ui; LootUI& $loot_ui; sf::RenderWindow& $window; routing::Router& $router; DNDLoot2(StatusUI& status_ui, LootUI& loot_ui, sf::RenderWindow& window, routing::Router& router); bool event(DNDEvent ev, std::any data={}); void mouse_action(bool hover); sf::Vector2f mouse_position(); }; sf::Vector2f DNDLoot2::mouse_position() { return $window.mapPixelToCoords($router.position); } void DNDLoot2::mouse_action(bool hover) { sf::Vector2f pos = mouse_position(); $status_ui.mouse(pos.x, pos.y, hover); if($loot_ui.active) $loot_ui.mouse(pos.x, pos.y, hover); } DNDLoot2::DNDLoot2(StatusUI& status_ui, LootUI& loot_ui, sf::RenderWindow &window, routing::Router& router) : $status_ui(status_ui), $loot_ui(loot_ui), $window(window), $router(router) { event(DNDEvent::STARTED); } bool DNDLoot2::event(DNDEvent event, std::any data) { int cs = 0; int *p = (int *)&event; int *pe = p+1; #line 67 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.cpp" { cs = DNDLoot_start; } #line 144 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl" #line 70 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.cpp" { if ( p == pe ) goto _test_eof; if ( cs == 0 ) goto _out; _resume: switch ( cs ) { case 1: if ( (*p) == 0 ) goto tr0; goto tr1; case 0: goto _out; case 2: switch( (*p) ) { case 14: goto tr2; case 16: goto tr3; case 17: goto tr4; case 19: goto tr5; } if ( (*p) > 21 ) { if ( 22 <= (*p) && (*p) <= 23 ) goto tr5; } else if ( (*p) >= 20 ) goto tr6; goto tr1; case 3: switch( (*p) ) { case 14: goto tr7; case 16: goto tr8; case 17: goto tr9; case 19: goto tr10; } if ( (*p) > 21 ) { if ( 22 <= (*p) && (*p) <= 23 ) goto tr10; } else if ( (*p) >= 20 ) goto tr11; goto tr1; case 4: switch( (*p) ) { case 14: goto tr0; case 15: goto tr3; } goto tr1; case 5: switch( (*p) ) { case 14: goto tr12; case 16: goto tr13; case 17: goto tr14; case 19: goto tr15; } if ( (*p) > 21 ) { if ( 22 <= (*p) && (*p) <= 23 ) goto tr15; } else if ( (*p) >= 20 ) goto tr16; goto tr1; } tr1: cs = 0; goto _again; tr0: cs = 2; goto _again; tr2: cs = 2; goto f0; tr8: cs = 2; goto f1; tr14: cs = 2; goto f2; tr5: cs = 2; goto f3; tr6: cs = 2; goto f4; tr9: cs = 2; goto f5; tr13: cs = 2; goto f6; tr3: cs = 3; goto f1; tr10: cs = 3; goto f3; tr11: cs = 3; goto f4; tr12: cs = 4; goto f0; tr7: cs = 4; goto f1; tr4: cs = 5; goto f2; tr15: cs = 5; goto f3; tr16: cs = 5; goto f4; f0: #line 18 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl" { $loot_ui.active = false; } goto _again; f1: #line 22 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl" { // NOTE: when grab_source could work to do the if that was here $grab_source = UISystem::loot_grab($loot_ui.$gui, data); } goto _again; f2: #line 27 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl" { $grab_source = UISystem::loot_grab($status_ui.$gui, data); } goto _again; f6: #line 31 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl" { if(UISystem::loot_drop($status_ui.$gui, $loot_ui.$gui, $grab_source, data)) { cs = 2; } } goto _again; f5: #line 39 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl" { if(UISystem::loot_drop($loot_ui.$gui, $status_ui.$gui, $grab_source, data)) { cs = 2; } } goto _again; f3: #line 51 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl" { mouse_action(false); } goto _again; f4: #line 55 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl" { if($grab_source) { auto& source = $loot_ui.$gui.get(*$grab_source); source.move($window.mapPixelToCoords($router.position)); } mouse_action(true); } goto _again; _again: if ( cs == 0 ) goto _out; if ( ++p != pe ) goto _resume; _test_eof: {} _out: {} } #line 145 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl" return false; } }