diff --git a/Makefile b/Makefile index 3c7cc0c..9e0fc75 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ tracy_build: meson compile -j 10 -C builddir test: build - ./builddir/runtests "[rituals-belt]" + ./builddir/runtests run: build test ifeq '$(OS)' 'Windows_NT' diff --git a/assets/config.json b/assets/config.json index 5db2b83..bd93845 100644 --- a/assets/config.json +++ b/assets/config.json @@ -31,7 +31,7 @@ }, "sprites": { "gold_savior": - {"path": "assets/gold_savior-256.png", + {"path": "assets/gold_savior_oil-256.png", "frame_width": 256, "frame_height": 256 }, diff --git a/assets/enemies.json b/assets/enemies.json index c666d24..b7ecb76 100644 --- a/assets/enemies.json +++ b/assets/enemies.json @@ -11,6 +11,21 @@ {"_type": "LightSource", "strength": 45, "radius": 2.0} ] }, + "GOLD_SAVIOR": { + "components": [ + {"_type": "Tile", "display": 2189, + "foreground": [131, 213, 238], + "background": [30, 20, 75] + }, + {"_type": "Combat", "hp": 20, "max_hp": 20, "damage": 1, "dead": false}, + {"_type": "Motion", "dx": 0, "dy": 0, "random": false}, + {"_type": "EnemyConfig", "ai_script": "Enemy::actions", "ai_start_name": "Enemy::initial_state", "ai_goal_name": "Enemy::final_state"}, + {"_type": "Personality", "hearing_distance": 5, "tough": true}, + {"_type": "Animation", "easing": 1, "ease_rate": 0.2, "scale": 0.1, "simple": true, "frames": 10, "speed": 0.3, "stationary": false}, + {"_type": "Sprite", "name": "gold_savior", "width": 256, "height": 256, "width": 256, "height": 256, "scale": 1.0}, + {"_type": "Sound", "attack": "Sword_Hit_2", "death": "Humanoid_Death_1"} + ] + }, "KNIGHT": { "components": [ {"_type": "Tile", "display": 2189, diff --git a/assets/gold_savior_oil-256.png b/assets/gold_savior_oil-256.png new file mode 100644 index 0000000..9375d03 Binary files /dev/null and b/assets/gold_savior_oil-256.png differ diff --git a/debug_ui.cpp b/debug_ui.cpp index 8c18efe..f992bca 100644 --- a/debug_ui.cpp +++ b/debug_ui.cpp @@ -29,6 +29,7 @@ namespace gui { add_spawn_button("KNIGHT","armored_knight", "spawn2"); add_spawn_button("SPIDER_GIANT_HAIRY", "hairy_spider", "spawn3"); add_spawn_button("RAT_GIANT", "rat_with_sword", "spawn4"); + add_spawn_button("GOLD_SAVIOR", "gold_savior", "spawn5"); $gui.init(); } diff --git a/guecs.cpp b/guecs.cpp index 3c52abf..dc7dabf 100644 --- a/guecs.cpp +++ b/guecs.cpp @@ -147,7 +147,7 @@ namespace guecs { DinkyECS::Entity UI::entity(std::string name) { dbc::check($name_ents.contains(name), - fmt::format("GUECS entity {} does not exist. Forgot to init_entity?", name)); + fmt::format("GUECS entity {} does not exist. Mispelled cell name?", name)); return $name_ents.at(name); } @@ -282,13 +282,8 @@ namespace guecs { void UI::show_sprite(string region, string sprite_name) { auto ent = entity(region); - - if(!has(ent)) { - Sprite to_show{sprite_name}; - auto& cell = cell_for(ent); - to_show.init(cell); - set(ent, to_show); - } + // BUG: this should have two branches that just update the sprite + set_init(ent, {sprite_name}); } void UI::show_text(string region, wstring content) { diff --git a/guecs.hpp b/guecs.hpp index 68158ee..f686bc7 100644 --- a/guecs.hpp +++ b/guecs.hpp @@ -203,10 +203,13 @@ namespace guecs { $world.remove(ent); } + // BUG: close could just be remove with overload template void close(string region) { auto ent = entity(region); - remove(ent); + if(has(ent)) { + remove(ent); + } } template @@ -229,8 +232,6 @@ namespace guecs { void show_sprite(string region, string sprite_name); void show_text(string region, wstring content); - void update_text(string region, wstring content); - void update_label(string region, wstring content); void show_label(string region, wstring content); }; diff --git a/gui_fsm.cpp b/gui_fsm.cpp index 55f2030..2c9e016 100644 --- a/gui_fsm.cpp +++ b/gui_fsm.cpp @@ -228,6 +228,7 @@ namespace gui { void FSM::keyboard_mouse() { while(const auto ev = $window.pollEvent()) { + if(ev->is()) { event(Event::QUIT); } diff --git a/ritual_ui.cpp b/ritual_ui.cpp index 6949099..fccafa6 100644 --- a/ritual_ui.cpp +++ b/ritual_ui.cpp @@ -24,8 +24,8 @@ namespace gui { "[*%(100,200)result_image|_ |_]" "[_|_|_]" "[combine|_|_]" - "[_|craft1|craft2|craft3|craft4|_]" - "[_|craft5|craft6|craft7|craft8|_]" + "[_|craft0|craft1|craft2|craft3|_]" + "[_|craft4|craft5|craft6|craft7|_]" "[ ritual_ui ]"); } @@ -49,10 +49,10 @@ namespace gui { L"Celiac migas\nunicorn hexagon.\nBrooklyn williamsburg\ntruffaut pickled\nchillwave raclette\nchurch-key sus.", 16, ColorValue::LIGHT_LIGHT, 10}); auto reset = $gui.entity("reset"); - $gui.set(reset, {}); + $gui.set(reset, {5, {60, 60, 60, 30}}); $gui.set