diff --git a/res/genshin_pursuit_author.map2d.yaml b/res/genshin_pursuit_author.map2d.yaml new file mode 100644 index 0000000..2827b37 --- /dev/null +++ b/res/genshin_pursuit_author.map2d.yaml @@ -0,0 +1,5 @@ +file: "genshin_pursuit_author.png" +name: "genshin_pursuit_author" +blocks: + - uv: [0, 128, 0, 128] + at: [0, 0] diff --git a/res/genshin_pursuit_author.png b/res/genshin_pursuit_author.png new file mode 100644 index 0000000..37f4f4e Binary files /dev/null and b/res/genshin_pursuit_author.png differ diff --git a/res/genshin_pursuit_author.pxo b/res/genshin_pursuit_author.pxo new file mode 100644 index 0000000..c724604 Binary files /dev/null and b/res/genshin_pursuit_author.pxo differ diff --git a/res/genshin_pursuit_entry.map2d.yaml b/res/genshin_pursuit_entry.map2d.yaml index 93d7750..1f42981 100644 --- a/res/genshin_pursuit_entry.map2d.yaml +++ b/res/genshin_pursuit_entry.map2d.yaml @@ -1,5 +1,5 @@ file: "genshin_pursuit_entry.png" name: "genshin_pursuit_entry" blocks: - - uv: [0, 128, 0, 256] + - uv: [0, 128, 0, 160] at: [0, 0] diff --git a/res/genshin_pursuit_entry.png b/res/genshin_pursuit_entry.png index 46f95cd..fefb8df 100644 Binary files a/res/genshin_pursuit_entry.png and b/res/genshin_pursuit_entry.png differ diff --git a/res/genshin_pursuit_entry.pxo b/res/genshin_pursuit_entry.pxo index 8626d59..ec16483 100644 Binary files a/res/genshin_pursuit_entry.pxo and b/res/genshin_pursuit_entry.pxo differ diff --git a/res/genshin_pursuit_main.map2d.yaml b/res/genshin_pursuit_main.map2d.yaml new file mode 100644 index 0000000..25e17a9 --- /dev/null +++ b/res/genshin_pursuit_main.map2d.yaml @@ -0,0 +1,5 @@ +file: "genshin_pursuit_main.png" +name: "genshin_pursuit_main" +blocks: + - uv: [0, 512, 0, 384] + at: [0, 0] diff --git a/src/main/activities/avg_scene.cpp b/src/main/activities/avg_scene.cpp index 0e47d9d..6bc52de 100644 --- a/src/main/activities/avg_scene.cpp +++ b/src/main/activities/avg_scene.cpp @@ -20,6 +20,9 @@ avg_scene::string_map avg_scene::scene_scripts = { {"dorm_stairs_middle", avg_scripts::dorm_stairs_middle}, {"dorm_stairs_bottom", avg_scripts::dorm_stairs_bottom}, {"black_jack_entry", avg_scripts::black_jack_entry}, + {"genshin_pursuit_entry", avg_scripts::genshin_pursuit_entry}, + {"genshin_pursuit_author", avg_scripts::genshin_pursuit_author}, + {"genshin_pursuit_main", avg_scripts::genshin_pursuit_main}, }; avg_scene::entity_comp_t avg_scene::default_sprites_sorter() { diff --git a/src/main/activities/avg_scripts.hpp b/src/main/activities/avg_scripts.hpp index 811f563..66aa179 100644 --- a/src/main/activities/avg_scripts.hpp +++ b/src/main/activities/avg_scripts.hpp @@ -58,6 +58,16 @@ static inline constexpr struct { eng::basics::vec2 black_jack_entry_default = {512, 352}; eng::basics::vec2 black_jack_entry_left = {36, 352}; eng::basics::vec2 black_jack_entry_right = {988, 352}; + + eng::basics::vec2 genshin_pursuit_entry_default = {256, 432}; + eng::basics::vec2 genshin_pursuit_entry_top = {256, 228}; + eng::basics::vec2 genshin_pursuit_entry_bottom = {256, 604}; + + eng::basics::vec2 genshin_pursuit_author_default = {384, 256}; + eng::basics::vec2 genshin_pursuit_author_right = {476, 256}; + + eng::basics::vec2 genshin_pursuit_main_default = {1024, 1152}; + eng::basics::vec2 genshin_pursuit_main_bottom = {1024, 1388}; } points; #define AVG_SCRIPT_ARGS avg_scene& self, const std::optional& spawn, const std::string& arg @@ -71,6 +81,9 @@ void dorm_stairs(AVG_SCRIPT_ARGS); void dorm_stairs_middle(AVG_SCRIPT_ARGS); void dorm_stairs_bottom(AVG_SCRIPT_ARGS); void black_jack_entry(AVG_SCRIPT_ARGS); +void genshin_pursuit_entry(AVG_SCRIPT_ARGS); +void genshin_pursuit_author(AVG_SCRIPT_ARGS); +void genshin_pursuit_main(AVG_SCRIPT_ARGS); #undef AVG_SCRIPT_ARGS diff --git a/src/main/activities/avg_scripts/dorm_room.cpp b/src/main/activities/avg_scripts/dorm_room.cpp index 2a3edfd..8adb75a 100644 --- a/src/main/activities/avg_scripts/dorm_room.cpp +++ b/src/main/activities/avg_scripts/dorm_room.cpp @@ -77,6 +77,9 @@ void acts::avg_scripts::dorm_room(avg_scene& self, const std::optional("dorm_balcony", points.dorm_balcony_door, std::to_string(room_number)); } } }; + if (room_number == 605) { + colls[{person.ptr(), table_1.ptr()}] = [&](){ self.next("genshin_pursuit_entry", points.genshin_pursuit_entry_bottom); }; + } if (room_number == 311) { colls[{person.ptr(), table_2.ptr()}] = [&](){ self.next("black_jack_entry", points.black_jack_entry_left); }; colls[{person.ptr(), table_3.ptr()}] = [&](){ self.next("dorm_room", std::nullopt, "508"); }; diff --git a/src/main/activities/avg_scripts/genshin_pursuit_author.cpp b/src/main/activities/avg_scripts/genshin_pursuit_author.cpp new file mode 100644 index 0000000..7c5215c --- /dev/null +++ b/src/main/activities/avg_scripts/genshin_pursuit_author.cpp @@ -0,0 +1,41 @@ +#include "../avg_scripts.hpp" +#include "./utils.hpp" +#include "static_sprites.hpp" +#include "static_maps.hpp" + +using namespace acts::avg_scripts; +using namespace naive_engine; +using namespace silly_framework; + +void acts::avg_scripts::genshin_pursuit_author(avg_scene& self, const std::optional& spawn, const std::string& arg) { + coutils::sync::unleash_lambda([&]() -> coutils::async_fn { + // 出生点 + basics::vec2 spawn_pos = spawn.value_or(points.genshin_pursuit_author_default); + simulator::entity_node_t person(basics::aabb(-16, 16, -12, 12), spawn_pos); + self.simu.emplace(512, 512); + utils::add_main_char(self, person); + + self.bound_map.emplace(&maps::genshin_pursuit_author(), 4.0); + self.bound_sprites[person.ptr()] = {&sprites::container_small(), 4.0, {0, -36}}; + + // 地图边界固定阻挡物 + simulator::entity_node_t obstacles[] = { + {basics::aabb{0, 512, 0, 192}}, + {basics::aabb{0, 512, 320, 512}}, + {basics::aabb{0, 288, 192, 320}}, + }; + utils::add_map_obstacles(self, obstacles); + + simulator::entity_node_t + leave = {basics::aabb{496, 512, 192, 320}}; + utils::add_trigger_boxes(self, leave); + utils::coll_event_table colls { + { {person.ptr(), leave.ptr()}, [&](){ self.next("genshin_pursuit_entry", points.genshin_pursuit_entry_bottom); } }, + }; + + while (true) { + auto [_, evt_data] = co_await self.cohost.wait_event({simu_coro_host::EVT_COLLISION}); + utils::check_coll_events(self, colls, evt_data); + } + }); +} diff --git a/src/main/activities/avg_scripts/genshin_pursuit_entry.cpp b/src/main/activities/avg_scripts/genshin_pursuit_entry.cpp new file mode 100644 index 0000000..519a9d8 --- /dev/null +++ b/src/main/activities/avg_scripts/genshin_pursuit_entry.cpp @@ -0,0 +1,44 @@ +#include "../avg_scripts.hpp" +#include "./utils.hpp" +#include "static_sprites.hpp" +#include "static_maps.hpp" + +using namespace acts::avg_scripts; +using namespace naive_engine; +using namespace silly_framework; + +void acts::avg_scripts::genshin_pursuit_entry(avg_scene& self, const std::optional& spawn, const std::string& arg) { + coutils::sync::unleash_lambda([&]() -> coutils::async_fn { + // 出生点 + basics::vec2 spawn_pos = spawn.value_or(points.genshin_pursuit_entry_default); + simulator::entity_node_t person(basics::aabb(-16, 16, -12, 12), spawn_pos); + self.simu.emplace(512, 640); + utils::add_main_char(self, person); + + self.bound_map.emplace(&maps::genshin_pursuit_entry(), 4.0); + self.bound_sprites[person.ptr()] = {&sprites::container_small(), 4.0, {0, -36}}; + + // 地图边界固定阻挡物 + simulator::entity_node_t obstacles[] = { + {basics::aabb{0, 192, 0, 576}}, + {basics::aabb{320, 512, 0, 640}}, + }; + utils::add_map_obstacles(self, obstacles); + + simulator::entity_node_t + hidden = {basics::aabb{0, 16, 576, 640}}, + launch = {basics::aabb{192, 320, 0, 208}}, + leave = {basics::aabb{192, 320, 624, 640}}; + utils::add_trigger_boxes(self, hidden, launch, leave); + utils::coll_event_table colls { + { {person.ptr(), hidden.ptr()}, [&](){ self.next("genshin_pursuit_author", points.genshin_pursuit_author_right); } }, + { {person.ptr(), launch.ptr()}, [&](){ self.next("genshin_pursuit_main", points.genshin_pursuit_main_bottom); } }, + { {person.ptr(), leave.ptr()}, [&](){ self.next("dorm_room", std::nullopt, "605"); } }, + }; + + while (true) { + auto [_, evt_data] = co_await self.cohost.wait_event({simu_coro_host::EVT_COLLISION}); + utils::check_coll_events(self, colls, evt_data); + } + }); +} diff --git a/src/main/activities/avg_scripts/genshin_pursuit_main.cpp b/src/main/activities/avg_scripts/genshin_pursuit_main.cpp new file mode 100644 index 0000000..0fedf58 --- /dev/null +++ b/src/main/activities/avg_scripts/genshin_pursuit_main.cpp @@ -0,0 +1,37 @@ +#include "../avg_scripts.hpp" +#include "./utils.hpp" +#include "static_sprites.hpp" +#include "static_maps.hpp" + +using namespace acts::avg_scripts; +using namespace naive_engine; +using namespace silly_framework; + +void acts::avg_scripts::genshin_pursuit_main(avg_scene& self, const std::optional& spawn, const std::string& arg) { + coutils::sync::unleash_lambda([&]() -> coutils::async_fn { + // 出生点 + basics::vec2 spawn_pos = spawn.value_or(points.genshin_pursuit_entry_default); + simulator::entity_node_t person(basics::aabb(-16, 16, -12, 12), spawn_pos); + self.simu.emplace(2048, 1536); + utils::add_main_char(self, person); + + self.bound_map.emplace(&maps::genshin_pursuit_main(), 4.0); + self.bound_sprites[person.ptr()] = {&sprites::container_small(), 4.0, {0, -36}}; + + // 地图边界固定阻挡物 + //simulator::entity_node_t obstacles[] = {}; + //utils::add_map_obstacles(self, obstacles); + + simulator::entity_node_t + leave = {basics::aabb{896, 1152, 1408, 1536}}; + utils::add_trigger_boxes(self, leave); + utils::coll_event_table colls { + { {person.ptr(), leave.ptr()}, [&](){ self.next("genshin_pursuit_entry", points.genshin_pursuit_entry_top); } }, + }; + + while (true) { + auto [_, evt_data] = co_await self.cohost.wait_event({simu_coro_host::EVT_COLLISION}); + utils::check_coll_events(self, colls, evt_data); + } + }); +} diff --git a/src/main/static_maps.cpp b/src/main/static_maps.cpp index 639ac73..119dbe4 100644 --- a/src/main/static_maps.cpp +++ b/src/main/static_maps.cpp @@ -86,10 +86,26 @@ const map2d& maps::dorm_stairs_top() { ); return map; } +const map2d& maps::genshin_pursuit_author() { + static const map2d map("genshin_pursuit_author.png", + map_blocks{ + {{0, 128, 0, 128}, {0, 0}} + } + ); + return map; +} const map2d& maps::genshin_pursuit_entry() { static const map2d map("genshin_pursuit_entry.png", map_blocks{ - {{0, 128, 0, 256}, {0, 0}} + {{0, 128, 0, 160}, {0, 0}} + } + ); + return map; +} +const map2d& maps::genshin_pursuit_main() { + static const map2d map("genshin_pursuit_main.png", + map_blocks{ + {{0, 512, 0, 384}, {0, 0}} } ); return map; diff --git a/src/main/static_maps.hpp b/src/main/static_maps.hpp index 3d07275..f24c334 100644 --- a/src/main/static_maps.hpp +++ b/src/main/static_maps.hpp @@ -13,5 +13,7 @@ const silly_framework::map2d& dorm_stairs(); const silly_framework::map2d& dorm_stairs_bottom(); const silly_framework::map2d& dorm_stairs_middle(); const silly_framework::map2d& dorm_stairs_top(); +const silly_framework::map2d& genshin_pursuit_author(); const silly_framework::map2d& genshin_pursuit_entry(); +const silly_framework::map2d& genshin_pursuit_main(); } // namespace maps