Tried to use Ragel to create state machines but its lacking an incremental mode and doesn't do any logging of state activity so debugging is harder. Put it in scratchpad for reference though.
parent
7fc32b0248
commit
d99d9a68c8
@ -1,14 +0,0 @@ |
|||||||
#pragma once |
|
||||||
|
|
||||||
enum class DNDEvent { |
|
||||||
STARTED=0, |
|
||||||
LOOT_OPEN=14, |
|
||||||
LOOT_ITEM=15, |
|
||||||
LOOT_SELECT=16, |
|
||||||
INV_SELECT=17, |
|
||||||
MOUSE_CLICK=19, |
|
||||||
MOUSE_MOVE=20, |
|
||||||
MOUSE_DRAG=21, |
|
||||||
MOUSE_DRAG_START=22, |
|
||||||
MOUSE_DROP=23 |
|
||||||
}; |
|
@ -1,230 +0,0 @@ |
|||||||
|
|
||||||
#line 1 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
|
||||||
#include <iostream> |
|
||||||
#include "gui/dnd_events.hpp" |
|
||||||
#include <any> |
|
||||||
#include "gui/guecstra.hpp" |
|
||||||
#include "gui/uisystems.hpp" |
|
||||||
#include <guecs/ui.hpp> |
|
||||||
#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<guecs::Entity> $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<guecs::GrabSource>(*$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; |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,31 @@ |
|||||||
|
#pragma once |
||||||
|
|
||||||
|
namespace gui { |
||||||
|
enum class Event { |
||||||
|
STARTED=0, |
||||||
|
TICK=1, |
||||||
|
MOVE_FORWARD = 2, |
||||||
|
MOVE_BACK = 3, |
||||||
|
MOVE_LEFT = 4, |
||||||
|
MOVE_RIGHT = 5, |
||||||
|
MAP_OPEN = 6, |
||||||
|
CLOSE = 7, |
||||||
|
ROTATE_LEFT = 8, |
||||||
|
ROTATE_RIGHT = 9, |
||||||
|
ATTACK = 10, |
||||||
|
START_COMBAT = 11, |
||||||
|
STOP_COMBAT = 12, |
||||||
|
STAIRS_DOWN = 13, |
||||||
|
LOOT_OPEN=14, |
||||||
|
LOOT_ITEM=15, |
||||||
|
LOOT_SELECT=16, |
||||||
|
INV_SELECT=17, |
||||||
|
QUIT = 18, |
||||||
|
MOUSE_CLICK=19, |
||||||
|
MOUSE_MOVE=20, |
||||||
|
MOUSE_DRAG=21, |
||||||
|
MOUSE_DRAG_START=22, |
||||||
|
MOUSE_DROP=23, |
||||||
|
KEY_PRESS=24 |
||||||
|
}; |
||||||
|
} |
@ -0,0 +1,436 @@ |
|||||||
|
|
||||||
|
#line 1 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
#include "gui/dnd_loot_2.hpp" |
||||||
|
#include "gui/guecstra.hpp" |
||||||
|
#include "gui/uisystems.hpp" |
||||||
|
#include <guecs/ui.hpp> |
||||||
|
#include <fmt/core.h> |
||||||
|
#include "dbc.hpp" |
||||||
|
|
||||||
|
#define _log(M, F) {$cur_state = F; fmt::println("| {}:{} action={}, fcurs={}", __FILE_NAME__, __LINE__, #M, F);} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#line 131 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#line 14 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.cpp"
|
||||||
|
static const char _DNDLoot_eof_actions[] = { |
||||||
|
0, 0, 0, 0, 0, 10, 0, 10 |
||||||
|
}; |
||||||
|
|
||||||
|
static const int DNDLoot_start = 1; |
||||||
|
static const int DNDLoot_first_final = 8; |
||||||
|
static const int DNDLoot_error = 0; |
||||||
|
|
||||||
|
static const int DNDLoot_en_main = 1; |
||||||
|
static const int DNDLoot_en_main_looting = 2; |
||||||
|
|
||||||
|
|
||||||
|
#line 134 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
|
||||||
|
namespace gui { |
||||||
|
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) |
||||||
|
{ |
||||||
|
|
||||||
|
#line 43 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.cpp"
|
||||||
|
{ |
||||||
|
cs = DNDLoot_start; |
||||||
|
} |
||||||
|
|
||||||
|
#line 153 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
|
||||||
|
dbc::log("===================================="); |
||||||
|
event(Event::STARTED); |
||||||
|
dbc::log("---------------- END CONSTRICT ------"); |
||||||
|
} |
||||||
|
|
||||||
|
bool DNDLoot2::event(Event event, std::any data) { |
||||||
|
if(event == Event::TICK) return true; |
||||||
|
|
||||||
|
int *p = (int *)&event; |
||||||
|
int *pe = p+1; |
||||||
|
int *eof = pe; |
||||||
|
|
||||||
|
dbc::log(fmt::format(">>>> DND EVENT {}, state={}, cs={}, end={}", |
||||||
|
int(event), $cur_state, cs, $at_end)); |
||||||
|
|
||||||
|
|
||||||
|
#line 62 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.cpp"
|
||||||
|
{ |
||||||
|
int _ps = 0; |
||||||
|
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 17: goto tr4; |
||||||
|
case 19: goto tr5; |
||||||
|
} |
||||||
|
if ( (*p) < 20 ) { |
||||||
|
if ( 15 <= (*p) && (*p) <= 16 ) |
||||||
|
goto tr3; |
||||||
|
} else if ( (*p) > 21 ) { |
||||||
|
if ( 22 <= (*p) && (*p) <= 23 ) |
||||||
|
goto tr5; |
||||||
|
} else |
||||||
|
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 tr12; |
||||||
|
case 15: goto tr13; |
||||||
|
} |
||||||
|
goto tr1; |
||||||
|
case 5: |
||||||
|
switch( (*p) ) { |
||||||
|
case 14: goto tr15; |
||||||
|
case 17: goto tr17; |
||||||
|
case 19: goto tr18; |
||||||
|
} |
||||||
|
if ( (*p) < 20 ) { |
||||||
|
if ( 15 <= (*p) && (*p) <= 16 ) |
||||||
|
goto tr16; |
||||||
|
} else if ( (*p) > 21 ) { |
||||||
|
if ( 22 <= (*p) && (*p) <= 23 ) |
||||||
|
goto tr18; |
||||||
|
} else |
||||||
|
goto tr19; |
||||||
|
goto tr14; |
||||||
|
case 6: |
||||||
|
switch( (*p) ) { |
||||||
|
case 14: goto tr20; |
||||||
|
case 16: goto tr21; |
||||||
|
case 17: goto tr22; |
||||||
|
case 19: goto tr23; |
||||||
|
} |
||||||
|
if ( (*p) > 21 ) { |
||||||
|
if ( 22 <= (*p) && (*p) <= 23 ) |
||||||
|
goto tr23; |
||||||
|
} else if ( (*p) >= 20 ) |
||||||
|
goto tr24; |
||||||
|
goto tr1; |
||||||
|
case 7: |
||||||
|
switch( (*p) ) { |
||||||
|
case 14: goto tr25; |
||||||
|
case 16: goto tr26; |
||||||
|
case 17: goto tr27; |
||||||
|
case 19: goto tr28; |
||||||
|
} |
||||||
|
if ( (*p) > 21 ) { |
||||||
|
if ( 22 <= (*p) && (*p) <= 23 ) |
||||||
|
goto tr28; |
||||||
|
} else if ( (*p) >= 20 ) |
||||||
|
goto tr29; |
||||||
|
goto tr14; |
||||||
|
} |
||||||
|
|
||||||
|
tr1: cs = 0; goto _again; |
||||||
|
tr14: _ps = cs;cs = 0; goto f9; |
||||||
|
tr0: _ps = cs;cs = 2; goto f0; |
||||||
|
tr2: _ps = cs;cs = 2; goto f1; |
||||||
|
tr8: _ps = cs;cs = 2; goto f2; |
||||||
|
tr22: _ps = cs;cs = 2; goto f3; |
||||||
|
tr5: _ps = cs;cs = 2; goto f4; |
||||||
|
tr6: _ps = cs;cs = 2; goto f5; |
||||||
|
tr9: _ps = cs;cs = 2; goto f6; |
||||||
|
tr15: _ps = cs;cs = 2; goto f10; |
||||||
|
tr26: _ps = cs;cs = 2; goto f11; |
||||||
|
tr18: _ps = cs;cs = 2; goto f13; |
||||||
|
tr19: _ps = cs;cs = 2; goto f14; |
||||||
|
tr21: _ps = cs;cs = 2; goto f15; |
||||||
|
tr27: _ps = cs;cs = 2; goto f16; |
||||||
|
tr3: _ps = cs;cs = 3; goto f2; |
||||||
|
tr10: _ps = cs;cs = 3; goto f4; |
||||||
|
tr11: _ps = cs;cs = 3; goto f5; |
||||||
|
tr16: _ps = cs;cs = 3; goto f11; |
||||||
|
tr28: _ps = cs;cs = 3; goto f13; |
||||||
|
tr29: _ps = cs;cs = 3; goto f14; |
||||||
|
tr20: _ps = cs;cs = 4; goto f1; |
||||||
|
tr7: _ps = cs;cs = 4; goto f2; |
||||||
|
tr25: _ps = cs;cs = 4; goto f11; |
||||||
|
tr12: _ps = cs;cs = 5; goto f7; |
||||||
|
tr4: _ps = cs;cs = 6; goto f3; |
||||||
|
tr23: _ps = cs;cs = 6; goto f4; |
||||||
|
tr24: _ps = cs;cs = 6; goto f5; |
||||||
|
tr17: _ps = cs;cs = 6; goto f12; |
||||||
|
tr13: _ps = cs;cs = 7; goto f8; |
||||||
|
|
||||||
|
f9: |
||||||
|
#line 17 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
$cur_state = (_ps); |
||||||
|
fmt::println("!!! ERROR fcurs={}", (_ps)); |
||||||
|
} |
||||||
|
goto _again; |
||||||
|
f0: |
||||||
|
#line 22 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(started, (_ps)); |
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
goto _again; |
||||||
|
f1: |
||||||
|
#line 27 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(loot_close, (_ps)); |
||||||
|
$loot_ui.active = false; |
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
goto _again; |
||||||
|
f2: |
||||||
|
#line 33 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(loot_grab, (_ps)); |
||||||
|
// NOTE: when grab_source could work to do the if that was here
|
||||||
|
$grab_source = UISystem::loot_grab($loot_ui.$gui, data); |
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
goto _again; |
||||||
|
f3: |
||||||
|
#line 40 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(inv_grab, (_ps)); |
||||||
|
$grab_source = UISystem::loot_grab($status_ui.$gui, data); |
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
goto _again; |
||||||
|
f15: |
||||||
|
#line 46 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(loot_drop, (_ps)); |
||||||
|
if(UISystem::loot_drop($status_ui.$gui, |
||||||
|
$loot_ui.$gui, $grab_source, data)) |
||||||
|
{ |
||||||
|
cs = 2; |
||||||
|
} |
||||||
|
|
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
goto _again; |
||||||
|
f6: |
||||||
|
#line 57 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(inv_drop, (_ps)); |
||||||
|
if(UISystem::loot_drop($loot_ui.$gui, |
||||||
|
$status_ui.$gui, $grab_source, data)) |
||||||
|
{ |
||||||
|
cs = 2; |
||||||
|
} |
||||||
|
|
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
goto _again; |
||||||
|
f7: |
||||||
|
#line 68 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(at_end, (_ps)); |
||||||
|
fmt::println("> AT END"); |
||||||
|
$grab_source = std::nullopt; |
||||||
|
$at_end = true; |
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
goto _again; |
||||||
|
f4: |
||||||
|
#line 83 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(mouse_click, (_ps)); |
||||||
|
mouse_action(false); |
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
goto _again; |
||||||
|
f5: |
||||||
|
#line 89 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(mouse_move, (_ps)); |
||||||
|
if($grab_source) { |
||||||
|
auto& source = $loot_ui.$gui.get<guecs::GrabSource>(*$grab_source); |
||||||
|
source.move($window.mapPixelToCoords($router.position)); |
||||||
|
} |
||||||
|
mouse_action(true); |
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
goto _again; |
||||||
|
f10: |
||||||
|
#line 27 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(loot_close, (_ps)); |
||||||
|
$loot_ui.active = false; |
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
#line 76 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(not_end, (_ps)); |
||||||
|
fmt::println("% NOT_END"); |
||||||
|
$at_end = false; |
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
goto _again; |
||||||
|
f11: |
||||||
|
#line 33 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(loot_grab, (_ps)); |
||||||
|
// NOTE: when grab_source could work to do the if that was here
|
||||||
|
$grab_source = UISystem::loot_grab($loot_ui.$gui, data); |
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
#line 76 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(not_end, (_ps)); |
||||||
|
fmt::println("% NOT_END"); |
||||||
|
$at_end = false; |
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
goto _again; |
||||||
|
f12: |
||||||
|
#line 40 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(inv_grab, (_ps)); |
||||||
|
$grab_source = UISystem::loot_grab($status_ui.$gui, data); |
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
#line 76 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(not_end, (_ps)); |
||||||
|
fmt::println("% NOT_END"); |
||||||
|
$at_end = false; |
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
goto _again; |
||||||
|
f16: |
||||||
|
#line 57 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(inv_drop, (_ps)); |
||||||
|
if(UISystem::loot_drop($loot_ui.$gui, |
||||||
|
$status_ui.$gui, $grab_source, data)) |
||||||
|
{ |
||||||
|
cs = 2; |
||||||
|
} |
||||||
|
|
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
#line 76 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(not_end, (_ps)); |
||||||
|
fmt::println("% NOT_END"); |
||||||
|
$at_end = false; |
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
goto _again; |
||||||
|
f8: |
||||||
|
#line 68 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(at_end, (_ps)); |
||||||
|
fmt::println("> AT END"); |
||||||
|
$grab_source = std::nullopt; |
||||||
|
$at_end = true; |
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
#line 33 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(loot_grab, (_ps)); |
||||||
|
// NOTE: when grab_source could work to do the if that was here
|
||||||
|
$grab_source = UISystem::loot_grab($loot_ui.$gui, data); |
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
goto _again; |
||||||
|
f13: |
||||||
|
#line 83 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(mouse_click, (_ps)); |
||||||
|
mouse_action(false); |
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
#line 76 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(not_end, (_ps)); |
||||||
|
fmt::println("% NOT_END"); |
||||||
|
$at_end = false; |
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
goto _again; |
||||||
|
f14: |
||||||
|
#line 89 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(mouse_move, (_ps)); |
||||||
|
if($grab_source) { |
||||||
|
auto& source = $loot_ui.$gui.get<guecs::GrabSource>(*$grab_source); |
||||||
|
source.move($window.mapPixelToCoords($router.position)); |
||||||
|
} |
||||||
|
mouse_action(true); |
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
#line 76 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
_log(not_end, (_ps)); |
||||||
|
fmt::println("% NOT_END"); |
||||||
|
$at_end = false; |
||||||
|
{p++; goto _out; } |
||||||
|
} |
||||||
|
goto _again; |
||||||
|
|
||||||
|
_again: |
||||||
|
if ( cs == 0 ) |
||||||
|
goto _out; |
||||||
|
p += 1; |
||||||
|
goto _resume; |
||||||
|
if ( p == eof ) |
||||||
|
{ |
||||||
|
switch ( _DNDLoot_eof_actions[cs] ) { |
||||||
|
case 10: |
||||||
|
#line 17 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
{ |
||||||
|
$cur_state = (_ps); |
||||||
|
fmt::println("!!! ERROR fcurs={}", (_ps)); |
||||||
|
} |
||||||
|
break; |
||||||
|
#line 385 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.cpp"
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
_out: {} |
||||||
|
} |
||||||
|
|
||||||
|
#line 170 "C:/Users/lcthw/Projects/raycaster//gui/dnd_loot_2.rl"
|
||||||
|
|
||||||
|
dbc::log(fmt::format("<<<< DND EVENT {}, state={}, cs={}, end={}", |
||||||
|
int(event), $cur_state, cs, $at_end)); |
||||||
|
return $at_end; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue