Finish JerryScript Entity/Scene wiring; remove JSON serialize/deserialize

Register Entity, the generic Component wrapper, and Scene as JerryScript
classes (modulelist.c ties them together, plus their .d.ts stubs), so
scenes/entities can be built from script going forward instead of the
JSON scene format.

With scripting now the intended authoring path, drop the JSON
serialize/deserialize machinery entirely: componentdefinition_t's
serialize/deserialize callbacks, every component's *Serialize/
*Deserialize function, entitySerialize/entityDeserialize,
sceneSerialize/sceneDeserialize, and the "prefabs/<name>.json"/
"scenes/<name>.json" asset fallback in entityPrefabResolveAndApply/
scenePrefabResolveAndApply (C-coded prefabs only now). physicsshape.c
and its test are removed outright since they only existed for this.
game.c's test scene now comes from the existing overworldSceneCreate()
C builder instead of loading the now-deleted assets/scenes/test.json.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-30 11:19:08 -05:00
parent 015d90519f
commit e61914bad4
53 changed files with 576 additions and 2081 deletions
-51
View File
@@ -110,56 +110,6 @@ static void test_entityTriggerDefaultsAndAccessors(void **state) {
assert_int_equal(memoryGetAllocatedCount(), 0);
}
static void test_entityTriggerSerializeRoundTrip(void **state) {
entitymanager_t mgr;
entityManagerInit(&mgr);
entityid_t entity = entityManagerAdd(&mgr);
componentid_t trig = entityAddComponent(
&mgr, entity, COMPONENT_TYPE_TRIGGER
);
physicsshape_t sphere = {
.type = PHYSICS_SHAPE_SPHERE,
.data.sphere.radius = 3.0f
};
entityTriggerSetShape(&mgr, entity, trig, sphere);
entityTriggerSetCollideMask(&mgr, entity, trig, 0x4);
yyjson_mut_doc *doc = yyjson_mut_doc_new(NULL);
yyjson_mut_val *root = yyjson_mut_obj(doc);
yyjson_mut_doc_set_root(doc, root);
assert_true(
errorIsOk(entityTriggerSerialize(&mgr, entity, trig, doc, root))
);
size_t len = 0;
char_t *jsonStr = yyjson_mut_write(doc, 0, &len);
assert_non_null(jsonStr);
yyjson_mut_doc_free(doc);
yyjson_doc *readDoc = yyjson_read(jsonStr, len, 0);
free(jsonStr);
assert_non_null(readDoc);
entityid_t entity2 = entityManagerAdd(&mgr);
componentid_t trig2 = entityAddComponent(
&mgr, entity2, COMPONENT_TYPE_TRIGGER
);
assert_true(errorIsOk(entityTriggerDeserialize(
&mgr, entity2, trig2, yyjson_doc_get_root(readDoc)
)));
yyjson_doc_free(readDoc);
physicsshape_t got = entityTriggerGetShape(&mgr, entity2, trig2);
assert_int_equal(got.type, PHYSICS_SHAPE_SPHERE);
assert_float_equal(got.data.sphere.radius, 3.0f, 0.0001f);
assert_int_equal(entityTriggerGetCollideMask(&mgr, entity2, trig2), 0x4);
entityManagerDispose(&mgr);
assert_int_equal(memoryGetAllocatedCount(), 0);
}
static void test_entityTriggerEventSubscription(void **state) {
test_resetCallbackCounts();
@@ -203,7 +153,6 @@ static void test_entityTriggerEventSubscription(void **state) {
int main(int argc, char **argv) {
const struct CMUnitTest tests[] = {
cmocka_unit_test(test_entityTriggerDefaultsAndAccessors),
cmocka_unit_test(test_entityTriggerSerializeRoundTrip),
cmocka_unit_test(test_entityTriggerEventSubscription),
};