diff --git a/assets/games/liminal/prefabs/CMakeLists.txt b/assets/games/liminal/prefabs/CMakeLists.txt index 6445bbad..a7599abd 100644 --- a/assets/games/liminal/prefabs/CMakeLists.txt +++ b/assets/games/liminal/prefabs/CMakeLists.txt @@ -4,4 +4,5 @@ # https://opensource.org/licenses/MIT tool_prefab(${CMAKE_CURRENT_LIST_DIR}/EthPrefab.xml) -tool_prefab(${CMAKE_CURRENT_LIST_DIR}/VNTextbox.xml) \ No newline at end of file +tool_prefab(${CMAKE_CURRENT_LIST_DIR}/VNTextbox.xml) +tool_prefab(${CMAKE_CURRENT_LIST_DIR}/VNTextboxMonologue.xml) \ No newline at end of file diff --git a/assets/games/liminal/prefabs/VNTextbox.xml b/assets/games/liminal/prefabs/VNTextbox.xml index 74be4382..7adbc1e7 100644 --- a/assets/games/liminal/prefabs/VNTextbox.xml +++ b/assets/games/liminal/prefabs/VNTextbox.xml @@ -3,7 +3,6 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/assets/games/liminal/scenes/CMakeLists.txt b/assets/games/liminal/scenes/CMakeLists.txt index 2c80d7e9..ced9739c 100644 --- a/assets/games/liminal/scenes/CMakeLists.txt +++ b/assets/games/liminal/scenes/CMakeLists.txt @@ -3,5 +3,7 @@ # This software is released under the MIT License. # https://opensource.org/licenses/MIT -tool_scene(${CMAKE_CURRENT_LIST_DIR}/SceneBase.xml) -tool_vnscene(${CMAKE_CURRENT_LIST_DIR}/Scene1Prologue0.xml) \ No newline at end of file +tool_scene(${CMAKE_CURRENT_LIST_DIR}/SceneStandard.xml) +tool_scene(${CMAKE_CURRENT_LIST_DIR}/SceneMonologue.xml) +tool_vnscene(${CMAKE_CURRENT_LIST_DIR}/Scene1Prologue0.xml) +tool_vnscene(${CMAKE_CURRENT_LIST_DIR}/Scene1Prologue1.xml) \ No newline at end of file diff --git a/assets/games/liminal/scenes/Scene1Prologue0.xml b/assets/games/liminal/scenes/Scene1Prologue0.xml index de04d42e..1444c3ca 100644 --- a/assets/games/liminal/scenes/Scene1Prologue0.xml +++ b/assets/games/liminal/scenes/Scene1Prologue0.xml @@ -1,48 +1,37 @@ - - - - - - - + - - - - Confused to Angry + There is a bucket. - - - - Angry to Cross - - - - - - And you are dead soon. + + + \ No newline at end of file diff --git a/assets/games/liminal/scenes/Scene1Prologue1.xml b/assets/games/liminal/scenes/Scene1Prologue1.xml index 90da2e40..f20eea8b 100644 --- a/assets/games/liminal/scenes/Scene1Prologue1.xml +++ b/assets/games/liminal/scenes/Scene1Prologue1.xml @@ -1,90 +1,9 @@ - + - I wake. - - - - I gasp. I close my eyes - I’m fine, I’m fine. I'm still here. Breathing. - - - - That bucket was a dream. My death was a dream. I’m not dead. - - - - (Am I?) - - - - - (...) + whoa - - (Aren't I?) - - - - Of course I’m not. - - - - I exhale. My feet fall to the edges of my bed. Slowly, I raise myself to stand. - - - - My fingers tremble by the edges of my leg: I curl my hand in. My nails catch on my skin. They’re sharp, pastel pink. Done for Prom Day today. - - - - - The dream didn’t happen. How could it have? Prom Day hasn’t happened yet. - - - - I'm fine. - - - - (Didn’t it happen?) - - - - (It felt so…) - - - - (Real.) - - - - I tidy the bedsheets. Pull the corners over the bed’s edges, fluff up the pillows, pat away the sweat and the residue of a scream: my parents want it pretty. - - - - It wasn’t real. I only had a visceral dream, sunken into my brain as an anchor to a sea, as a stone angel’s crumbling visage, as a bird’s descent off Devil Cradle’s cliffs. That wasn’t real. - - - - No, of course not. - - - - My calendar says May 29th. I’ve got to prepare for Prom. - - - - After all, if there is anything I will be, it is Prom Queen. - - - - I’ve been chasing this moment since the beginning of time. Today is the finale. - - - - And I am nothing if not ready. - - + \ No newline at end of file diff --git a/assets/games/liminal/scenes/SceneMonologue.xml b/assets/games/liminal/scenes/SceneMonologue.xml new file mode 100644 index 00000000..fae22258 --- /dev/null +++ b/assets/games/liminal/scenes/SceneMonologue.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/games/liminal/scenes/SceneBase.xml b/assets/games/liminal/scenes/SceneStandard.xml similarity index 97% rename from assets/games/liminal/scenes/SceneBase.xml rename to assets/games/liminal/scenes/SceneStandard.xml index f1b887eb..61e5414f 100644 --- a/assets/games/liminal/scenes/SceneBase.xml +++ b/assets/games/liminal/scenes/SceneStandard.xml @@ -1,4 +1,4 @@ - + diff --git a/lib/SDL b/lib/SDL index 87a83787..c065a9b1 160000 --- a/lib/SDL +++ b/lib/SDL @@ -1 +1 @@ -Subproject commit 87a83787a3a0a9922b02b35ba809d9da86930fc8 +Subproject commit c065a9b1289a1de09981c46a4c5e53e3627fd95c diff --git a/lib/freetype b/lib/freetype index 5c00a468..e4586d96 160000 --- a/lib/freetype +++ b/lib/freetype @@ -1 +1 @@ -Subproject commit 5c00a46805d6423fc45b4ba2c0f2e22dd0450d73 +Subproject commit e4586d960f339cf75e2e0b34aee30a0ed8353c0d diff --git a/lib/glfw b/lib/glfw index 8f470597..3fa23607 160000 --- a/lib/glfw +++ b/lib/glfw @@ -1 +1 @@ -Subproject commit 8f470597d625ae28758c16b4293dd42d63e8a83a +Subproject commit 3fa2360720eeba1964df3c0ecf4b5df8648a8e52 diff --git a/lib/glm b/lib/glm index efec5db0..5c46b9c0 160000 --- a/lib/glm +++ b/lib/glm @@ -1 +1 @@ -Subproject commit efec5db081e3aad807d0731e172ac597f6a39447 +Subproject commit 5c46b9c07008ae65cb81ab79cd677ecc1934b903 diff --git a/lib/openal-soft b/lib/openal-soft index d66107e9..2da9d168 160000 --- a/lib/openal-soft +++ b/lib/openal-soft @@ -1 +1 @@ -Subproject commit d66107e9f008770b48f0df4fce041ee3e501e1e8 +Subproject commit 2da9d168b6bee32376889a394e11981a4515d041 diff --git a/src/dawn/asset/Asset.hpp b/src/dawn/asset/Asset.hpp index 87047d80..3c10a31d 100644 --- a/src/dawn/asset/Asset.hpp +++ b/src/dawn/asset/Asset.hpp @@ -14,7 +14,7 @@ namespace Dawn { AssetManager *assetManager; std::string name; uint8_t state = 0x00; - bool loaded = false; + bool_t loaded = false; Event<> eventLoaded; StateEvent<> event2Loaded; diff --git a/src/dawn/asset/AssetLoader.hpp b/src/dawn/asset/AssetLoader.hpp index 9d46a112..c3b5d4b8 100644 --- a/src/dawn/asset/AssetLoader.hpp +++ b/src/dawn/asset/AssetLoader.hpp @@ -95,11 +95,11 @@ namespace Dawn { * @return The count of bytes read. */ template - size_t loadBufferedCallback(T *instance, bool (T::*callback)(uint8_t n)) { + size_t loadBufferedCallback(T *instance, bool_t (T::*callback)(uint8_t n)) { uint8_t buffer[1024]; size_t read, length; int32_t i; - bool result; + bool_t result; assertNotNull(instance); assertNotNull(callback); diff --git a/src/dawn/display/Transform.cpp b/src/dawn/display/Transform.cpp index 710de272..a1a0058d 100644 --- a/src/dawn/display/Transform.cpp +++ b/src/dawn/display/Transform.cpp @@ -147,7 +147,7 @@ void Transform::setWorldTransform(glm::mat4 transform) { void Transform::setParent(Transform *parent) { - assertTrue(parent != this); + assertTrue(parent == nullptr || parent != this); auto currentParent = this->getParent(); if(currentParent == parent) return; @@ -190,6 +190,6 @@ Transform::~Transform() { auto it = this->children.begin(); while(it != this->children.end()) { (*it)->setParent(nullptr); - ++it; + it = this->children.begin(); } } \ No newline at end of file diff --git a/src/dawn/display/font/truetype/TrueTypeFaceTexture.cpp b/src/dawn/display/font/truetype/TrueTypeFaceTexture.cpp index eaf8cb4b..284ca0b8 100644 --- a/src/dawn/display/font/truetype/TrueTypeFaceTexture.cpp +++ b/src/dawn/display/font/truetype/TrueTypeFaceTexture.cpp @@ -32,6 +32,8 @@ TrueTypeFaceTexture::TrueTypeFaceTexture( assertUnreachable(); } + if(face->glyph->bitmap.width == 0 || face->glyph->bitmap.rows == 0) continue; + // Update the width and height w = mathMax(w, face->glyph->bitmap.width); h += face->glyph->bitmap.rows; diff --git a/src/dawn/game/DawnGame.cpp b/src/dawn/game/DawnGame.cpp index 3f337787..2fe2176b 100644 --- a/src/dawn/game/DawnGame.cpp +++ b/src/dawn/game/DawnGame.cpp @@ -33,6 +33,13 @@ int32_t DawnGame::update(float_t delta) { this->renderManager.update(); + if(this->sceneToCutTo != nullptr) { + delete this->scene; + this->scene = nullptr; + this->scene = this->sceneToCutTo; + this->sceneToCutTo = nullptr; + } + return DAWN_GAME_UPDATE_RESULT_SUCCESS; } diff --git a/src/dawn/games/vn/events/VNSceneChangeEvent.hpp b/src/dawn/games/vn/events/VNSceneChangeEvent.hpp new file mode 100644 index 00000000..d62e7138 --- /dev/null +++ b/src/dawn/games/vn/events/VNSceneChangeEvent.hpp @@ -0,0 +1,25 @@ +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "VNEvent.hpp" +#include "scene/Scene.hpp" + +namespace Dawn { + template + class VNSceneChangeEvent : public VNEvent { + protected: + void onStart() override { + auto game = this->manager->getGame(); + T *nextScene = new T(this->manager->getGame()); + + auto assets = nextScene->getRequiredAssets(); + game->assetManager.queueLoad(assets); + game->assetManager.syncLoad(); + nextScene->stage(); + game->sceneCutover(nextScene); + } + }; +} \ No newline at end of file diff --git a/src/dawn/scene/components/ui/CMakeLists.txt b/src/dawn/scene/components/ui/CMakeLists.txt index 866d6ffa..1c6c5c19 100644 --- a/src/dawn/scene/components/ui/CMakeLists.txt +++ b/src/dawn/scene/components/ui/CMakeLists.txt @@ -10,6 +10,7 @@ target_sources(${DAWN_TARGET_NAME} UIComponent.cpp UIComponentRenderable.cpp UIImage.cpp + UIEmpty.cpp UIBorder.cpp ) diff --git a/src/dawn/scene/components/ui/UIEmpty.cpp b/src/dawn/scene/components/ui/UIEmpty.cpp new file mode 100644 index 00000000..3c61d065 --- /dev/null +++ b/src/dawn/scene/components/ui/UIEmpty.cpp @@ -0,0 +1,15 @@ +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "UIEmpty.hpp" + +using namespace Dawn; + +UIEmpty::UIEmpty(SceneItem *item) : UIComponent(item) { } + +float_t UIEmpty::getContentWidth() { return 0.0f; } +float_t UIEmpty::getContentHeight() { return 0.0f; } +float_t UIEmpty::getChildOffsetX() { return 0.0f; } +float_t UIEmpty::getChildOffsetY() { return 0.0f; } \ No newline at end of file diff --git a/src/dawn/scene/components/ui/UIEmpty.hpp b/src/dawn/scene/components/ui/UIEmpty.hpp new file mode 100644 index 00000000..af4a2808 --- /dev/null +++ b/src/dawn/scene/components/ui/UIEmpty.hpp @@ -0,0 +1,18 @@ +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "UIComponent.hpp" + +namespace Dawn { + class UIEmpty : public UIComponent { + public: + UIEmpty(SceneItem *item); + float_t getContentWidth() override; + float_t getContentHeight() override; + float_t getChildOffsetX() override; + float_t getChildOffsetY() override; + }; +} \ No newline at end of file diff --git a/src/dawn/scene/components/ui/text/UILabel.cpp b/src/dawn/scene/components/ui/text/UILabel.cpp index 2c09cccf..015f0db1 100644 --- a/src/dawn/scene/components/ui/text/UILabel.cpp +++ b/src/dawn/scene/components/ui/text/UILabel.cpp @@ -211,7 +211,9 @@ void UILabel::rebufferQuads(const std::vector newTexts) { // Now, iterate each character for(int32_t i = 0; i < len; i++) { - char ch = text.text[i]; + std::u32string::value_type ch = text.text[i]; + // FT_ULong ch = text.text[i]; + char c = text.text[i]; // Handle special characters if(ch == '\n') { @@ -228,8 +230,7 @@ void UILabel::rebufferQuads(const std::vector newTexts) { assertTrue(ch != '\n'); // Get font data. - FT_ULong c = ch; - auto charInfo = realText.texture->getCharacterData(c); + auto charInfo = realText.texture->getCharacterData(ch); // Word wrapping if( diff --git a/src/dawnliminal/game/LiminalGame.cpp b/src/dawnliminal/game/LiminalGame.cpp index 0b992f0f..2fd104f0 100644 --- a/src/dawnliminal/game/LiminalGame.cpp +++ b/src/dawnliminal/game/LiminalGame.cpp @@ -4,12 +4,12 @@ // https://opensource.org/licenses/MIT #include "game/DawnGame.hpp" -#include "vnscenes/Scene1Prologue.hpp" +#include "vnscenes/Scene1Prologue0.hpp" #include "scenes/HelloWorldScene.hpp" using namespace Dawn; Scene * Dawn::dawnGameGetInitialScene(DawnGame *game) { // return new HelloWorldScene(game); - return new Scene1Prologue(game); + return new Scene1Prologue0(game); } \ No newline at end of file diff --git a/src/dawnshared/display/font/truetype/TrueTypeShared.hpp b/src/dawnshared/display/font/truetype/TrueTypeShared.hpp index 8c43d72b..d680c8be 100644 --- a/src/dawnshared/display/font/truetype/TrueTypeShared.hpp +++ b/src/dawnshared/display/font/truetype/TrueTypeShared.hpp @@ -6,8 +6,8 @@ #pragma once #include "util/flag.hpp" -#define TRUE_TYPE_CHAR_BEGIN 32 -#define TRUE_TYPE_CHAR_END 192 +#define TRUE_TYPE_CHAR_BEGIN 0x00 +#define TRUE_TYPE_CHAR_END 0xFF #define TRUE_TYPE_VARIANT_BOLD FLAG_DEFINE(0) #define TRUE_TYPE_VARIANT_ITALICS FLAG_DEFINE(1) \ No newline at end of file diff --git a/src/dawntools/util/File.cpp b/src/dawntools/util/File.cpp index e61a3754..f35938cc 100644 --- a/src/dawntools/util/File.cpp +++ b/src/dawntools/util/File.cpp @@ -21,8 +21,8 @@ void File::mkdirp(std::string path) { std::string buffer; char c; size_t i = 0; - bool inFile; - bool hasMore; + bool_t inFile; + bool_t hasMore; inFile = false; hasMore = false; diff --git a/src/dawntools/vnscenetool/VNSceneGen.cpp b/src/dawntools/vnscenetool/VNSceneGen.cpp index 29a13af8..bd74a32e 100644 --- a/src/dawntools/vnscenetool/VNSceneGen.cpp +++ b/src/dawntools/vnscenetool/VNSceneGen.cpp @@ -135,6 +135,12 @@ void VNSceneGen::test( break; } + case VN_SCENE_EVENT_TYPE_SCENE_CHANGE: + initType = "VNSceneChangeEvent<" + event->sceneChange.scene + ">"; + toInclude = "games/vn/events/VNSceneChangeEvent.hpp"; + includes->push_back(event->sceneChange.include); + break; + default: std::cout << "Unknown event type: " << event->type << std::endl; assertUnreachable(); diff --git a/src/dawntools/vnscenetool/events/CMakeLists.txt b/src/dawntools/vnscenetool/events/CMakeLists.txt index 65223eee..04e13042 100644 --- a/src/dawntools/vnscenetool/events/CMakeLists.txt +++ b/src/dawntools/vnscenetool/events/CMakeLists.txt @@ -17,4 +17,5 @@ target_sources(vnscenetool VNChoiceEventParser.cpp VNChoiceSetEventParser.cpp VNIfEventParser.cpp + VNSceneChangeEventParser.cpp ) \ No newline at end of file diff --git a/src/dawntools/vnscenetool/events/VNSceneChangeEventParser.cpp b/src/dawntools/vnscenetool/events/VNSceneChangeEventParser.cpp new file mode 100644 index 00000000..3a35594c --- /dev/null +++ b/src/dawntools/vnscenetool/events/VNSceneChangeEventParser.cpp @@ -0,0 +1,33 @@ +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "VNSceneChangeEventParser.hpp" + +using namespace Dawn; + +std::vector VNSceneChangeEventParser::getRequiredAttributes() { + return { "scene" }; +} + +std::map VNSceneChangeEventParser::getOptionalAttributes() { + return {}; +} + +int32_t VNSceneChangeEventParser::onParse( + Xml *node, + std::map values, + struct VNSceneChangeEvent *out, + std::string *error +) { + out->include = values["scene"] + ".hpp"; + + // Find last slash and take all string after that + size_t lastSlash = values["scene"].find_last_of('/'); + if(lastSlash != std::string::npos) { + out->scene = values["scene"].substr(lastSlash+1); + } + + return 0; +} \ No newline at end of file diff --git a/src/dawntools/vnscenetool/events/VNSceneChangeEventParser.hpp b/src/dawntools/vnscenetool/events/VNSceneChangeEventParser.hpp new file mode 100644 index 00000000..616dcb20 --- /dev/null +++ b/src/dawntools/vnscenetool/events/VNSceneChangeEventParser.hpp @@ -0,0 +1,26 @@ +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "util/XmlParser.hpp" + +namespace Dawn { + struct VNSceneChangeEvent { + std::string scene; + std::string include; + }; + + class VNSceneChangeEventParser : public XmlParser { + protected: + std::vector getRequiredAttributes() override; + std::map getOptionalAttributes() override; + int32_t onParse( + Xml *node, + std::map values, + struct VNSceneChangeEvent *out, + std::string *error + ) override; + }; +} \ No newline at end of file diff --git a/src/dawntools/vnscenetool/events/VNSceneEventsParser.cpp b/src/dawntools/vnscenetool/events/VNSceneEventsParser.cpp index 383144dc..456da5fc 100644 --- a/src/dawntools/vnscenetool/events/VNSceneEventsParser.cpp +++ b/src/dawntools/vnscenetool/events/VNSceneEventsParser.cpp @@ -80,6 +80,11 @@ int32_t VNSceneEventsParser::onParse( ret = (VNIfEventParser()).parse(child, &event.ifEvent, error); if(ret != 0) return ret; + } else if(child->node == "scene-change") { + event.type = VN_SCENE_EVENT_TYPE_SCENE_CHANGE; + ret = (VNSceneChangeEventParser()).parse(child, &event.sceneChange, error); + if(ret != 0) return ret; + } else { *error = "Unknown child node '" + child->node + "'"; return -1; diff --git a/src/dawntools/vnscenetool/events/VNSceneEventsParser.hpp b/src/dawntools/vnscenetool/events/VNSceneEventsParser.hpp index 88dba049..76bba0f5 100644 --- a/src/dawntools/vnscenetool/events/VNSceneEventsParser.hpp +++ b/src/dawntools/vnscenetool/events/VNSceneEventsParser.hpp @@ -14,6 +14,7 @@ #include "VNChoiceEventParser.hpp" #include "VNChoiceSetEventParser.hpp" #include "VNIfEventParser.hpp" +#include "VNSceneChangeEventParser.hpp" namespace Dawn { struct VNSceneEvent; @@ -32,7 +33,8 @@ namespace Dawn { VN_SCENE_EVENT_TYPE_GOTO_MARKER, VN_SCENE_EVENT_TYPE_CHOICES, VN_SCENE_EVENT_TYPE_CHOICE_SET, - VN_SCENE_EVENT_TYPE_IF + VN_SCENE_EVENT_TYPE_IF, + VN_SCENE_EVENT_TYPE_SCENE_CHANGE }; struct VNParallelEvent { @@ -58,6 +60,7 @@ namespace Dawn { struct VNChoiceEvent choices; struct VNChoiceSetEvent choiceSet; struct VNIfEvent ifEvent; + struct VNSceneChangeEvent sceneChange; }; class VNSceneEventsParser : public XmlParser {