Curation round 3: Lua engine, Manager, sound, menus, cutscenes, rooms, item pools, saves; boots past LuaEngine::Init
Seven agents took over LuaEngine (the mod API registration deferred), the rest of Manager (LoadConfigs, fonts, render surfaces, Update/Render), MusicManager/SFXManager, MenuManager with the title/save/game menus, Cutscene/NightmareScene/ Backdrop, RoomConfig (src/rooms ported and retired) with ItemPool, and PersistentGameData (the original binary save format) with InfoDisplay. An integration pass moved call sites to the new APIs, declared the taken-over free functions, fixed two data.cpp crashes (an empty children array, null attribute strings), and made the generator keep a header's own name where a prototype names another address. Clean build (0 warnings with -Wall -Wextra). build/isaac runs the game's Lua scripts (without the mod API yet) and stops at reload_resource_paths. 901 functions taken over, boot path 204/615. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a7061306fa
commit
ddf913f304
137 files changed
+12684
-50687
No files matched your search
+13
-4
@@ -1,6 +1,10 @@
|
||||
#include "data.h"
|
||||
#include <cctype>
|
||||
|
||||
constexpr std::string_view EMPTY_ARRAY = "[]";
|
||||
// What a missing tag, attribute or text reads as: empty, but C text that atoi can take.
|
||||
constexpr std::string_view EMPTY_TEXT = "";
|
||||
|
||||
std::string dataDirectory = "resources/";
|
||||
|
||||
// Where a game path lives once imported: under the data directory, lowercased with forward slashes, as the game
|
||||
@@ -27,25 +31,30 @@ void data_load(Data& data, std::string_view path)
|
||||
std::string_view node_tag(DataNode node)
|
||||
{
|
||||
std::string_view tag;
|
||||
return node["tag"].get(tag) == simdjson::SUCCESS ? tag : std::string_view();
|
||||
return node["tag"].get(tag) == simdjson::SUCCESS ? tag : EMPTY_TEXT;
|
||||
}
|
||||
|
||||
// An attribute's raw string, or an empty one when the element lacks it.
|
||||
std::string_view node_attr(DataNode node, std::string_view name)
|
||||
{
|
||||
std::string_view value;
|
||||
return node["attrs"][name].get(value) == simdjson::SUCCESS ? value : std::string_view();
|
||||
return node["attrs"][name].get(value) == simdjson::SUCCESS ? value : EMPTY_TEXT;
|
||||
}
|
||||
|
||||
std::string_view node_text(DataNode node)
|
||||
{
|
||||
std::string_view text;
|
||||
return node["text"].get(text) == simdjson::SUCCESS ? text : std::string_view();
|
||||
return node["text"].get(text) == simdjson::SUCCESS ? text : EMPTY_TEXT;
|
||||
}
|
||||
|
||||
// The element's children in document order, empty when it has none.
|
||||
// A default-constructed array points at no document, so a parsed empty one stands in.
|
||||
simdjson::dom::array node_children(DataNode node)
|
||||
{
|
||||
static simdjson::dom::parser emptyParser;
|
||||
static simdjson::dom::array empty =
|
||||
emptyParser.parse(EMPTY_ARRAY.data(), EMPTY_ARRAY.size()).get_array().value_unsafe();
|
||||
simdjson::dom::array children;
|
||||
return node["children"].get(children) == simdjson::SUCCESS ? children : simdjson::dom::array();
|
||||
|
||||
return node["children"].get(children) == simdjson::SUCCESS ? children : empty;
|
||||
}
|
||||
Reference in new issue
Block a user