stuck
This commit is contained in:
@ -10,56 +10,4 @@
|
|||||||
<QuadMeshHost xy0="-0.78236397748, 1" xy1="0.78236397748, -1" />
|
<QuadMeshHost xy0="-0.78236397748, 1" xy1="0.78236397748, -1" />
|
||||||
<SimpleTexturedMaterial ref="bodyMaterial" />
|
<SimpleTexturedMaterial ref="bodyMaterial" />
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
<asset type="texture" name="texture_eth_face_day_anger" ref="faceDayAnger" />
|
|
||||||
<asset type="texture" name="texture_eth_face_day_confused" ref="faceDayConfused" />
|
|
||||||
<asset type="texture" name="texture_eth_face_day_eyeroll" ref="faceDayEyeroll" />
|
|
||||||
<asset type="texture" name="texture_eth_face_day_fear" ref="faceDayFear" />
|
|
||||||
<asset type="texture" name="texture_eth_face_day_happy" ref="faceDayHappy" />
|
|
||||||
<asset type="texture" name="texture_eth_face_day_haughty" ref="faceDayHaughty" />
|
|
||||||
<asset type="texture" name="texture_eth_face_day_neutral" ref="faceDayNeutral" />
|
|
||||||
<asset type="texture" name="texture_eth_face_day_sad" ref="faceDaySad" />
|
|
||||||
<asset type="texture" name="texture_eth_face_day_surprised" ref="faceDaySurprised" />
|
|
||||||
|
|
||||||
<asset type="texture" name="texture_eth_pose_day_back" ref="poseDayBack" />
|
|
||||||
<asset type="texture" name="texture_eth_pose_day_cross" ref="poseDayCross" />
|
|
||||||
<asset type="texture" name="texture_eth_pose_day_front" ref="poseDayFront" />
|
|
||||||
<asset type="texture" name="texture_eth_pose_day_hips" ref="poseDayHips" />
|
|
||||||
<asset type="texture" name="texture_eth_pose_day_neutral" ref="poseDayNeutral" />
|
|
||||||
|
|
||||||
<code type="properties">
|
|
||||||
StateProperty<int32_t> faceTile;
|
|
||||||
StateProperty<int32_t> poseTile;
|
|
||||||
</code>
|
|
||||||
|
|
||||||
<code type="init">
|
|
||||||
faceTile = 0;
|
|
||||||
poseTile = 0;
|
|
||||||
|
|
||||||
useEffect([&]{
|
|
||||||
faceMaterial->texture = &(
|
|
||||||
faceTile == 0 ? faceDayHappy->texture :
|
|
||||||
faceTile == 1 ? faceDayAnger->texture :
|
|
||||||
faceTile == 2 ? faceDayConfused->texture :
|
|
||||||
faceTile == 3 ? faceDayEyeroll->texture :
|
|
||||||
faceTile == 4 ? faceDayFear->texture :
|
|
||||||
faceTile == 5 ? faceDayHaughty->texture :
|
|
||||||
faceTile == 6 ? faceDayNeutral->texture :
|
|
||||||
faceTile == 7 ? faceDaySad->texture :
|
|
||||||
faceTile == 8 ? faceDaySurprised->texture :
|
|
||||||
faceDayHappy->texture
|
|
||||||
);
|
|
||||||
}, faceTile)();
|
|
||||||
|
|
||||||
useEffect([&]{
|
|
||||||
bodyMaterial->texture = &(
|
|
||||||
poseTile == 0 ? poseDayBack->texture :
|
|
||||||
poseTile == 1 ? poseDayCross->texture :
|
|
||||||
poseTile == 2 ? poseDayFront->texture :
|
|
||||||
poseTile == 3 ? poseDayHips->texture :
|
|
||||||
poseTile == 4 ? poseDayNeutral->texture :
|
|
||||||
poseDayBack->texture
|
|
||||||
);
|
|
||||||
}, poseTile)();
|
|
||||||
</code>
|
|
||||||
</prefab>
|
</prefab>
|
@ -4,4 +4,4 @@
|
|||||||
# https://opensource.org/licenses/MIT
|
# https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
tool_scene(${CMAKE_CURRENT_LIST_DIR}/SceneBase.xml)
|
tool_scene(${CMAKE_CURRENT_LIST_DIR}/SceneBase.xml)
|
||||||
tool_vnscene(${CMAKE_CURRENT_LIST_DIR}/Scene1Prologue0.xml)
|
# tool_vnscene(${CMAKE_CURRENT_LIST_DIR}/Scene1Prologue0.xml)
|
@ -1,23 +1,25 @@
|
|||||||
<vnscene name="Scene1Prologue" extend="scenes/SceneBase">
|
<vnscene name="Scene1Prologue" extend="scenes/SceneBase">
|
||||||
|
|
||||||
|
<asset type="texture" name="texture_eth_face_day_anger" ref="faceDayAnger" />
|
||||||
|
<asset type="texture" name="texture_eth_pose_day_back" ref="poseDayBack" />
|
||||||
|
|
||||||
<events>
|
<events>
|
||||||
|
<set property="eth->faceMaterial->texture" to="&faceDayAnger->texture" type="Texture*" />
|
||||||
|
<set property="eth->faceMaterial->texture" to="&faceDayAnger->texture" type="Texture*" />
|
||||||
|
<set property="eth->faceMaterial->texture" to="&faceDayAnger->texture" type="Texture*" />
|
||||||
|
|
||||||
<text>
|
<text>
|
||||||
<string lang="en"><font style="italics">There is a bucket.</font></string>
|
<string lang="en"><font style="italics">There is a bucket.</font></string>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<set property="eth->faceTile" to="1" type="int32_t" />
|
|
||||||
|
|
||||||
<text>
|
<text>
|
||||||
<string lang="en">It sways above your head like the mouth of a god. You are on Angelwood's best stage, and they are cheering for you, calling you their Queen, their Prom Queen.</string>
|
<string lang="en">It sways above your head like the mouth of a god. You are on Angelwood's best stage, and they are cheering for you, calling you their Queen, their Prom Queen.</string>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<!-- <set property="eth->faceSprite->tile" to="0" type="int32_t" /> -->
|
|
||||||
|
|
||||||
<text>
|
<text>
|
||||||
<string lang="en">And you are dead soon.</string>
|
<string lang="en">And you are dead soon.</string>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<!-- <set property="eth->bodySprite->tile" to="3" type="int32_t" /> -->
|
|
||||||
|
|
||||||
<text>
|
<text>
|
||||||
<string lang="en">It's Prom Day. The metal bucket is swaying. Over you. Drenching your white pristine dress in guts and gore red. They aren't cheering anymore. They're gasping. But not screaming: oh, no, not in respectable Angelwood.</string>
|
<string lang="en">It's Prom Day. The metal bucket is swaying. Over you. Drenching your white pristine dress in guts and gore red. They aren't cheering anymore. They're gasping. But not screaming: oh, no, not in respectable Angelwood.</string>
|
||||||
</text>
|
</text>
|
||||||
|
@ -4,24 +4,20 @@
|
|||||||
// https://opensource.org/licenses/MIT
|
// https://opensource.org/licenses/MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "VNAnimateEvent.hpp"
|
#include "VNEvent.hpp"
|
||||||
|
|
||||||
namespace Dawn {
|
namespace Dawn {
|
||||||
template<typename T>
|
template<class T>
|
||||||
class VNSetEvent : public VNAnimateEvent<T> {
|
class VNSetEvent : public VNEvent {
|
||||||
public:
|
public:
|
||||||
StateProperty<T> *modifies = nullptr;
|
T *modifies = nullptr;
|
||||||
|
T value;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onStart() override {
|
void onStart() override {
|
||||||
assertNotNull(this->modifies);
|
assertNotNull(this->modifies);
|
||||||
this->from = modifies->getValue();
|
*modifies = value;
|
||||||
|
this->next();
|
||||||
VNAnimateEvent<T>::onStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setValue(T value) override {
|
|
||||||
modifies->setValue(value);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -14,13 +14,15 @@ void SceneGenerator::generate(
|
|||||||
struct MethodGenInfo &methodInit
|
struct MethodGenInfo &methodInit
|
||||||
) {
|
) {
|
||||||
assertNotNull(scene);
|
assertNotNull(scene);
|
||||||
|
|
||||||
|
std::map<std::string, std::string> assetMap;
|
||||||
|
int32_t assetNumber = 0;
|
||||||
|
std::string baseClassName = "Scene";
|
||||||
|
|
||||||
classInfo.clazz = scene->name;
|
classInfo.clazz = scene->name;
|
||||||
classInfo.constructorArgs = "DawnGame *game";
|
classInfo.constructorArgs = "DawnGame *game";
|
||||||
classInfo.extendArgs = "game";
|
classInfo.extendArgs = "game";
|
||||||
|
|
||||||
std::string baseClassName = "Scene";
|
|
||||||
|
|
||||||
// Determine extends
|
// Determine extends
|
||||||
if(scene->extend.empty()) {
|
if(scene->extend.empty()) {
|
||||||
classInfo.includes.push_back("scene/Scene.hpp");
|
classInfo.includes.push_back("scene/Scene.hpp");
|
||||||
@ -39,7 +41,7 @@ void SceneGenerator::generate(
|
|||||||
methodAssets.name = "getRequiredAssets";
|
methodAssets.name = "getRequiredAssets";
|
||||||
methodAssets.isOverride = true;
|
methodAssets.isOverride = true;
|
||||||
methodAssets.type = "std::vector<Asset*>";
|
methodAssets.type = "std::vector<Asset*>";
|
||||||
line(&methodAssets.body, "auto assMan = &this->game->assetManager;", "");
|
line(&methodAssets.body, "auto man = &this->game->assetManager;", "");
|
||||||
|
|
||||||
methodInit.name = "stage";
|
methodInit.name = "stage";
|
||||||
methodInit.isOverride = true;
|
methodInit.isOverride = true;
|
||||||
@ -51,11 +53,26 @@ void SceneGenerator::generate(
|
|||||||
line(&methodInit.body, baseClassName + "::stage();", "");
|
line(&methodInit.body, baseClassName + "::stage();", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Scene assets
|
||||||
|
line(&methodInit.body, "auto man = &this->game->assetManager;", "");
|
||||||
|
|
||||||
|
auto itAssets = scene->assets.begin();
|
||||||
|
while(itAssets != scene->assets.end()) {
|
||||||
|
SceneAssetGenerator::generate(
|
||||||
|
assetMap,
|
||||||
|
assetNumber,
|
||||||
|
&classInfo.publicProperties,
|
||||||
|
&methodInit.body,
|
||||||
|
&methodAssets.body,
|
||||||
|
&(*itAssets),
|
||||||
|
""
|
||||||
|
);
|
||||||
|
++itAssets;
|
||||||
|
}
|
||||||
|
|
||||||
// Generate
|
// Generate
|
||||||
int32_t assetNumber = 0;
|
|
||||||
int32_t childNumber = 0;
|
int32_t childNumber = 0;
|
||||||
int32_t componentNumber = 0;
|
int32_t componentNumber = 0;
|
||||||
std::map<std::string, std::string> assetMap;
|
|
||||||
std::vector<struct SceneItemComponent> componentsUnused;
|
std::vector<struct SceneItemComponent> componentsUnused;
|
||||||
|
|
||||||
auto itDeps = scene->dependencies.begin();
|
auto itDeps = scene->dependencies.begin();
|
||||||
|
@ -118,7 +118,7 @@ void SceneItemGenerator::generate(
|
|||||||
// Create prefab
|
// Create prefab
|
||||||
includes.push_back(item->prefab + ".hpp");
|
includes.push_back(item->prefab + ".hpp");
|
||||||
line(initBody, (item->ref.empty() ? "auto " : "") + name + " = " + prefabName + "::create(" + sceneRef + ");", "");
|
line(initBody, (item->ref.empty() ? "auto " : "") + name + " = " + prefabName + "::create(" + sceneRef + ");", "");
|
||||||
line(assetBody, "vectorAppend(&assets, " + prefabName + "::getRequiredAssets(assMan));", "");
|
line(assetBody, "vectorAppend(&assets, " + prefabName + "::getRequiredAssets(man));", "");
|
||||||
} else {
|
} else {
|
||||||
// Not a prefab, init empty child.
|
// Not a prefab, init empty child.
|
||||||
line(initBody, (item->ref.empty() ? "auto " : "") + name + " = " + sceneRef + "->createSceneItem();", "");
|
line(initBody, (item->ref.empty() ? "auto " : "") + name + " = " + sceneRef + "->createSceneItem();", "");
|
||||||
|
@ -35,8 +35,14 @@ int32_t SceneParser::onParse(
|
|||||||
auto itChildren = node->children.begin();
|
auto itChildren = node->children.begin();
|
||||||
while(itChildren != node->children.end()) {
|
while(itChildren != node->children.end()) {
|
||||||
Xml *child = *itChildren;
|
Xml *child = *itChildren;
|
||||||
|
|
||||||
if(child->node == "item") {
|
if(child->node == "asset") {
|
||||||
|
struct SceneAsset asset;
|
||||||
|
auto ret = (SceneAssetParser()).parse(child, &asset, error);
|
||||||
|
if(ret != 0) return ret;
|
||||||
|
out->assets.push_back(asset);
|
||||||
|
|
||||||
|
} else if(child->node == "item") {
|
||||||
struct SceneItem item;
|
struct SceneItem item;
|
||||||
item.registry = out->registry;
|
item.registry = out->registry;
|
||||||
ret = (SceneItemParser()).parse(child, &item, error);
|
ret = (SceneItemParser()).parse(child, &item, error);
|
||||||
|
@ -13,6 +13,7 @@ namespace Dawn {
|
|||||||
std::string extend;
|
std::string extend;
|
||||||
std::vector<struct SceneItem> items;
|
std::vector<struct SceneItem> items;
|
||||||
std::vector<struct SceneCode> code;
|
std::vector<struct SceneCode> code;
|
||||||
|
std::vector<struct SceneAsset> assets;
|
||||||
struct SceneItemComponentRegistry *registry;
|
struct SceneItemComponentRegistry *registry;
|
||||||
std::vector<struct SceneItemDependency> dependencies;
|
std::vector<struct SceneItemDependency> dependencies;
|
||||||
};
|
};
|
||||||
|
@ -39,9 +39,7 @@ void VNSceneGen::test(
|
|||||||
initType = "VNSetEvent<" + event->set.type + ">";
|
initType = "VNSetEvent<" + event->set.type + ">";
|
||||||
toInclude = "games/vn/events/VNSetEvent.hpp";
|
toInclude = "games/vn/events/VNSetEvent.hpp";
|
||||||
line(&afterLines, eventName + "->modifies = &" + event->set.property + ";", "");
|
line(&afterLines, eventName + "->modifies = &" + event->set.property + ";", "");
|
||||||
line(&afterLines, eventName + "->to = " + event->set.to + ";", "");
|
line(&afterLines, eventName + "->value = " + event->set.to + ";", "");
|
||||||
if(event->set.from != "") line(&afterLines, eventName + "->from = " + event->set.from + ";", "");
|
|
||||||
if(event->set.duration != "") line(&afterLines, eventName + "->duration = " + event->set.duration + ";", "");
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VN_SCENE_EVENT_TYPE_WAIT:
|
case VN_SCENE_EVENT_TYPE_WAIT:
|
||||||
|
@ -14,10 +14,7 @@ std::vector<std::string> VNSetEventParser::getRequiredAttributes() {
|
|||||||
std::map<std::string, std::string> VNSetEventParser::getOptionalAttributes() {
|
std::map<std::string, std::string> VNSetEventParser::getOptionalAttributes() {
|
||||||
return {
|
return {
|
||||||
{ "to", "" },
|
{ "to", "" },
|
||||||
{ "value", "" },
|
{ "value", "" }
|
||||||
{ "from", "" },
|
|
||||||
{ "duration", "" },
|
|
||||||
{ "curve", "" }
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,8 +35,5 @@ int32_t VNSetEventParser::onParse(
|
|||||||
|
|
||||||
out->type = values["type"];
|
out->type = values["type"];
|
||||||
out->property = values["property"];
|
out->property = values["property"];
|
||||||
out->from = values["from"];
|
|
||||||
out->duration = values["duration"];
|
|
||||||
out->curve = values["curve"];
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
@ -10,9 +10,6 @@ namespace Dawn {
|
|||||||
struct VNSetEvent {
|
struct VNSetEvent {
|
||||||
std::string property = "";
|
std::string property = "";
|
||||||
std::string to = "";
|
std::string to = "";
|
||||||
std::string from = "";
|
|
||||||
std::string duration = "";
|
|
||||||
std::string curve = "";
|
|
||||||
std::string type = "";
|
std::string type = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user