1
0

Compare commits

..

2 Commits

Author SHA1 Message Date
f0160ce7c2 doc: add unvirt doc 2026-03-03 00:14:17 +08:00
b78732f30c feat: add new rule in BMapInspector 2026-03-02 23:51:53 +08:00
5 changed files with 269 additions and 0 deletions

View File

@@ -32,6 +32,7 @@ namespace BMapInspector::Rule {
rules.emplace_back(new BBugRule1());
rules.emplace_back(new ZZQRule1());
rules.emplace_back(new ZZQRule2());
rules.emplace_back(new ZZQRule3());
rules.emplace_back(new SOneRule1());
rules.emplace_back(new SSBRule1());
rules.emplace_back(new LXRule1());

View File

@@ -16,6 +16,11 @@ namespace BMapInspector::Rule::Shared {
namespace GroupNames {
// clang-format off
constexpr char8_t PS_LEVELSTART[] = u8"PS_Levelstart";
constexpr char8_t PE_LEVELENDE[] = u8"PE_Levelende";
constexpr char8_t PC_CHECKPOINTS[] = u8"PC_Checkpoints";
constexpr char8_t PR_RESETPOINTS[] = u8"PR_Resetpoints";
constexpr char8_t PHYS_FLOORS[] = u8"Phys_Floors";
constexpr char8_t PHYS_FLOORRAILS[] = u8"Phys_FloorRails";
constexpr char8_t PHYS_FLOORSTOPPER[] = u8"Phys_FloorStopper";

View File

@@ -143,4 +143,79 @@ namespace BMapInspector::Rule {
#pragma endregion
#pragma region ZZQ Rule 3
constexpr char8_t ZZQ3[] = u8"ZZQ3";
ZZQRule3::ZZQRule3() : IRule() {}
ZZQRule3::~ZZQRule3() {}
std::u8string_view ZZQRule3::GetRuleName() const {
return ZZQ3;
}
void ZZQRule3::Check(Reporter::Reporter& reporter, Map::Level& level) const {
auto* ctx = level.GetCKContext();
Shared::SectorNameBuilder builder;
auto* level_start = Shared::FetchGroup(ctx, Shared::GroupNames::PS_LEVELSTART);
if (level_start == nullptr) {
reporter.WriteError(ZZQ3, u8R"(Incomplete level: can not find "PS_Levelstart" group.)");
} else {
switch (level_start->GetObjectCount()) {
case 0:
reporter.WriteError(ZZQ3, u8R"(Incomplete level: there is no object grouped into "PS_Levelstart" group.)");
break;
case 1:
// OK. Do nothing.
break;
default:
reporter.WriteError(ZZQ3, u8R"(Bad level: there are more than one objects grouped into "PS_Levelstart" group.)");
break;
}
}
auto* level_end = Shared::FetchGroup(ctx, Shared::GroupNames::PE_LEVELENDE);
if (level_end == nullptr) {
reporter.WriteError(ZZQ3, u8R"(Incomplete level: can not find "PE_Levelende" group.)");
} else {
switch (level_end->GetObjectCount()) {
case 0:
reporter.WriteError(ZZQ3, u8R"(Incomplete level: there is no object grouped into "PE_Levelende" group.)");
break;
case 1:
// OK. Do nothing.
break;
default:
reporter.WriteError(ZZQ3, u8R"(Bad level: there are more than one objects grouped into "PE_Levelende" group.)");
break;
}
}
auto* check_points = Shared::FetchGroup(ctx, Shared::GroupNames::PC_CHECKPOINTS);
if (check_points == nullptr) {
reporter
.WriteWarning(ZZQ3,
u8R"(Can not find "PC_Checkpoints" group. This will cause bad render of particle at the level start point.)");
}
auto* reset_points = Shared::FetchGroup(ctx, Shared::GroupNames::PR_RESETPOINTS);
if (reset_points == nullptr) {
reporter.WriteError(ZZQ3, u8R"(Incomplete level: can not find "PR_Resetpoints" group.)");
} else {
if (reset_points->GetObjectCount() == 0) {
reporter.WriteError(ZZQ3, u8R"(Incomplete level: there is no object grouped into "PC_Resetpoints" group.)");
}
}
auto sector1_name = builder.get_name(1);
auto* sector1 = Shared::FetchGroup(ctx, sector1_name.c_str());
if (sector1 == nullptr) {
reporter.WriteError(ZZQ3, u8R"(Incomplete level: can not find "Sector_01" group.)");
}
}
#pragma endregion
} // namespace BMapInspector::Rule

View File

@@ -41,4 +41,24 @@ namespace BMapInspector::Rule {
void Check(Reporter::Reporter& reporter, Map::Level& level) const override;
};
/**
* @brief ZZQ Rule 3
* @details
* A minimalist level must contains following items:
* \li One start point.
* \li One end point (spaceship).
* \li One reset point.
* \li "Sector_01" group.
*/
class ZZQRule3 : public IRule {
public:
ZZQRule3();
virtual ~ZZQRule3();
YYCC_DELETE_COPY_MOVE(ZZQRule3)
public:
std::u8string_view GetRuleName() const override;
void Check(Reporter::Reporter& reporter, Map::Level& level) const override;
};
}

168
Docs/UNVIRT.md Normal file
View File

@@ -0,0 +1,168 @@
# Unvirt Command Reference
## File Operations
### Load File
Syntax: `load [deep | shallow] <filepath>`
Description: Load a Virtools composition.
Arguments:
- `[deep | shallow]`: The stage of loading.
* `shallow` will load to CKStateChunk stage.
* `deep` will load to CKObject stage.
- `<filepath>`: The path to loaded file.
### Unload File
Syntax: `unload`
Description: Release loaded Virtools composition.
### Save File
Syntax: `save <filepath>`
Description: Save the loaded file into a new file.
Arguments:
- `<filepath>`: The path to saved file.
## List & Search
### Show Header Info
Syntax: `info`
Description: Show the header infomation of loaded Virtools composition.
### List Objects, Managers or Search Result
Syntax: `ls [obj | mgr | search] <page>`
Description: List objects, managers of loaded Virtools composition,
or the search result of them.
Arguments:
- `[obj | mgr | search]`: Which one you want to list.
- `<page>`: The page index. Start with 1.
### Show Object or Manager Data
Syntax: `data [obj | mgr] <index>`
Description: Show the data of specified object or manager.
Arguments:
- `[obj | mgr]`: Which one you want to show data.
- `<index>`: The index of object or manager which can be fetched by list command. Start with 0.
### Show State Chunk Data
Syntax: `chunk [obj | mgr] <index>`
Description: Show the specific CKStateChunk data.
Arguments:
- `[obj | mgr]`: Which one you want to show chunk
- `<index>`: The index of object or manager which can be fetched by list command. Start with 0.
### Search Objects or Managers
Syntax: `search [obj | mgr] [plain | re] <text>`
Description: Search the name of object or manager= by plain text or regex.
Please note that the regex have limited UTF8 support and may cause undefined behavior.
Arguments:
- `[obj | mgr]`: Which one you want to search.
- `[plain | re]`: The search mode.
* `plain` will search by plain string. It simply check whether name has your given substring.
* `re` will do regex search.
- `<text>`: The plain text or regex to search.
## Display
### Page Item Count
Syntax: `items <count>`
Description: Set up how many items should be listed in one page when using 'ls' command.
Arguments:
- `<count>`: The count of items you want to show in one page
### Display Style
Syntax: `style [full | simple]`
Description: Change the detail level of shown data in `ls` command.
Arguments:
- `[full | simple]`: The style of shown content.
* `full` will show more detailed information.
* `simple` will show less information.
## Environment
### Set Encoding
Syntax: `encoding <enc>`
Description: Set the encoding series for Virtools composition loading ans saving.
Arguments:
- `<enc>`: CKContext used encoding separated by ','. Support multiple encoding.
### Temp Path
Syntax: `temp <temppath>`
Description: Set the Temp path for CKContext.
Arguments:
- `<temppath>`: The path to Temp folder
### Data Resource Path
#### Clear Data Resource Path
Syntax: `rsc clear`
Description: Clear all data resources paths.
#### Add Data Resource Path
Syntax: `rsc add <datares>`
Description: Manage data resources paths.
Arguments:
- `<datares>`: The data resources path.
## System
### Debug Test
Syntax: `test`
Description: Call custom debugging function (only available in Debug mode).
### Show Version
Syntax: `version`
Description: Show the version info about this program.
### Show Help
Syntax: `help`
Description: Output this help page.
### Exit Program
Syntax: `exit`
Description: Exit program.