diff --git a/assets/Data/Script/Harry/Acts/0/Chapters/ScenarioHarryAct0Chapter1.c b/assets/Data/Script/Harry/Acts/0/Chapters/ScenarioHarryAct0Chapter1.c index 7e722ee..4c4a91b 100644 --- a/assets/Data/Script/Harry/Acts/0/Chapters/ScenarioHarryAct0Chapter1.c +++ b/assets/Data/Script/Harry/Acts/0/Chapters/ScenarioHarryAct0Chapter1.c @@ -61,6 +61,7 @@ const struct Scene PlayNovelScenarioHarryAct0Chapter1Sub1Scene1 = { "Das Geräusch des Motors hallt in der \nDunkelheit wider. Wegen einer kleinen Panne\nvorhin ist es so spät geworden.", } }, + NULL, }; PositionedEntityROMSpec PlayNovelScenarioHarryAct0Chapter1Sub1Scene2Entities[] = @@ -85,6 +86,7 @@ const struct Scene PlayNovelScenarioHarryAct0Chapter1Sub1Scene2 = { "Ich bin Harry Mason.\nEin Allerweltsschriftsteller.", } }, + NULL, }; PositionedEntityROMSpec PlayNovelScenarioHarryAct0Chapter1Sub1Scene3Entities[] = @@ -114,6 +116,7 @@ const struct Scene PlayNovelScenarioHarryAct0Chapter1Sub1Scene3 = { "unersetzlich geworden. \nCheryl hatte sich sehr auf diese Reise \ngefreut.", } }, + NULL, }; PositionedEntityROMSpec PlayNovelScenarioHarryAct0Chapter1Sub1Scene4Entities[] = @@ -137,6 +140,7 @@ const struct Scene PlayNovelScenarioHarryAct0Chapter1Sub1Scene4 = { { } }, + NULL, }; PositionedEntityROMSpec PlayNovelScenarioHarryAct0Chapter1Sub1Scene5Entities[] = @@ -162,6 +166,7 @@ const struct Scene PlayNovelScenarioHarryAct0Chapter1Sub1Scene5 = { { } }, + NULL, }; PositionedEntityROMSpec PlayNovelScenarioHarryAct0Chapter1Sub1Scene6Entities[] = @@ -185,6 +190,7 @@ const struct Scene PlayNovelScenarioHarryAct0Chapter1Sub1Scene6 = { { } }, + NULL, }; PositionedEntityROMSpec PlayNovelScenarioHarryAct0Chapter1Sub1Scene7Entities[] = @@ -209,6 +215,7 @@ const struct Scene PlayNovelScenarioHarryAct0Chapter1Sub1Scene7 = { { } }, + NULL, }; PositionedEntityROMSpec PlayNovelScenarioHarryAct0Chapter1Sub1Scene8Entities[] = @@ -234,6 +241,7 @@ const struct Scene PlayNovelScenarioHarryAct0Chapter1Sub1Scene8 = { { } }, + NULL, }; PositionedEntityROMSpec PlayNovelScenarioHarryAct0Chapter1Sub1Scene9Entities[] = @@ -258,6 +266,7 @@ const struct Scene PlayNovelScenarioHarryAct0Chapter1Sub1Scene9 = { { } }, + NULL, }; PositionedEntityROMSpec PlayNovelScenarioHarryAct0Chapter1Sub1Scene10Entities[] = @@ -282,6 +291,7 @@ const struct Scene PlayNovelScenarioHarryAct0Chapter1Sub1Scene10 = { { } }, + NULL, }; PositionedEntityROMSpec PlayNovelScenarioHarryAct0Chapter1Sub1Scene11Entities[] = @@ -309,6 +319,7 @@ const struct Scene PlayNovelScenarioHarryAct0Chapter1Sub1Scene11 = { { } }, + NULL, }; PositionedEntityROMSpec PlayNovelScenarioHarryAct0Chapter1Sub1Scene12Entities[] = @@ -331,6 +342,7 @@ const struct Scene PlayNovelScenarioHarryAct0Chapter1Sub1Scene12 = { { } }, + NULL, }; PositionedEntityROMSpec PlayNovelScenarioHarryAct0Chapter1Sub1Scene13Entities[] = @@ -354,6 +366,7 @@ const struct Scene PlayNovelScenarioHarryAct0Chapter1Sub1Scene13 = { { } }, + NULL, }; const struct Scene PlayNovelScenarioHarryAct0Chapter1Sub1Scene14 = { @@ -371,6 +384,7 @@ const struct Scene PlayNovelScenarioHarryAct0Chapter1Sub1Scene14 = { "" } }, + NULL, }; const struct SubChapter PlayNovelScenarioHarryAct0Chapter1Sub1 = { diff --git a/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter1.c b/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter1.c index 3d83a14..00ccd02 100644 --- a/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter1.c +++ b/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter1.c @@ -53,6 +53,7 @@ const struct Scene PlayNovelScenarioHarryAct1Chapter1Sub1Scene1 = { { } }, + NULL, }; const struct SubChapter PlayNovelScenarioHarryAct1Chapter1Sub1 = { @@ -92,6 +93,7 @@ const struct Scene PlayNovelScenarioHarryAct1Chapter1Sub2Scene1 = { { } }, + NULL, }; PositionedEntityROMSpec PlayNovelScenarioHarryAct1Chapter1Sub2Scene2Entities[] = @@ -114,6 +116,7 @@ const struct Scene PlayNovelScenarioHarryAct1Chapter1Sub2Scene2 = { { } }, + NULL, }; const struct SubChapter PlayNovelScenarioHarryAct1Chapter1Sub2 = { @@ -154,6 +157,7 @@ const struct Scene PlayNovelScenarioHarryAct1Chapter1Sub3Scene1 = { { } }, + NULL, }; PositionedEntityROMSpec PlayNovelScenarioHarryAct1Chapter1Sub3Scene2Entities[] = @@ -177,6 +181,7 @@ const struct Scene PlayNovelScenarioHarryAct1Chapter1Sub3Scene2 = { { } }, + NULL, }; const struct SubChapter PlayNovelScenarioHarryAct1Chapter1Sub3 = { diff --git a/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter2.c b/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter2.c index 8a0ec47..8e1db58 100644 --- a/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter2.c +++ b/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter2.c @@ -72,6 +72,7 @@ const struct Scene PlayNovelScenarioHarryAct1Chapter2Sub1Scene1 = { { } }, + NULL, }; const struct SubChapter PlayNovelScenarioHarryAct1Chapter2Sub1 = { diff --git a/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter3.c b/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter3.c index 0f37fea..b23581d 100644 --- a/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter3.c +++ b/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter3.c @@ -52,6 +52,7 @@ const struct Scene PlayNovelScenarioHarryAct1Chapter3Sub1Scene1 = { { } }, + NULL, }; const struct SubChapter PlayNovelScenarioHarryAct1Chapter3Sub1 = { diff --git a/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter4.c b/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter4.c index ef38d15..a5ad152 100644 --- a/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter4.c +++ b/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter4.c @@ -52,6 +52,7 @@ const struct Scene PlayNovelScenarioHarryAct1Chapter4Sub1Scene1 = { { } }, + NULL, }; PositionedEntityROMSpec PlayNovelScenarioHarryAct1Chapter4Sub1Scene2Entities[] = @@ -79,6 +80,7 @@ const struct Scene PlayNovelScenarioHarryAct1Chapter4Sub1Scene2 = { { } }, + NULL, }; PositionedEntityROMSpec PlayNovelScenarioHarryAct1Chapter4Sub1Scene3Entities[] = @@ -104,6 +106,7 @@ const struct Scene PlayNovelScenarioHarryAct1Chapter4Sub1Scene3 = { { } }, + NULL, }; PositionedEntityROMSpec PlayNovelScenarioHarryAct1Chapter4Sub1Scene4Entities[] = @@ -128,6 +131,7 @@ const struct Scene PlayNovelScenarioHarryAct1Chapter4Sub1Scene4 = { { } }, + NULL, }; PositionedEntityROMSpec PlayNovelScenarioHarryAct1Chapter4Sub1Scene5Entities[] = @@ -151,6 +155,7 @@ const struct Scene PlayNovelScenarioHarryAct1Chapter4Sub1Scene5 = { { } }, + NULL, }; const struct SubChapter PlayNovelScenarioHarryAct1Chapter4Sub1 = { diff --git a/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter5.c b/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter5.c index 8f03066..8bafe60 100644 --- a/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter5.c +++ b/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter5.c @@ -74,6 +74,7 @@ const struct Scene PlayNovelScenarioHarryAct1Chapter5Sub1Scene1 = { { } }, + NULL, }; const struct SubChapter PlayNovelScenarioHarryAct1Chapter5Sub1 = { diff --git a/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter6.c b/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter6.c index ca7c42c..bd6007b 100644 --- a/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter6.c +++ b/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter6.c @@ -52,6 +52,7 @@ const struct Scene PlayNovelScenarioHarryAct1Chapter6Sub1Scene1 = { { } }, + NULL, }; PositionedEntityROMSpec PlayNovelScenarioHarryAct1Chapter6Sub1Scene2Entities[] = @@ -60,42 +61,33 @@ PositionedEntityROMSpec PlayNovelScenarioHarryAct1Chapter6Sub1Scene2Entities[] = {NULL, {0,0,0,0}, 0, NULL, NULL, NULL, false}, }; -const struct Scene PlayNovelScenarioHarryAct1Chapter6Sub1Scene2 = { - kFadeTypeNormal, - kFadeTypeNormal, - kSoundWrapperPlaybackNormal, - NULL, - (PositionedEntity*)PlayNovelScenarioHarryAct1Chapter6Sub1Scene2Entities, - NULL, +const struct BranchingTargets PlayNovelScenarioHarryAct1Chapter6Sub1Scene2BranchingTargets = +{ { { - "\"Ah...\"", - "And then my vitality is sucked away by these \nstrangely shaped monsters until I finally \nlose consciousness..." - }, - { + { + 1, 6, 0, 2, + }, } - }, -}; - -PositionedEntityROMSpec PlayNovelScenarioHarryAct1Chapter6Sub1Scene3Entities[] = -{ - {NULL, {0,0,0,0}, 0, NULL, NULL, NULL, false}, + } }; -const struct Scene PlayNovelScenarioHarryAct1Chapter6Sub1Scene3 = { +const struct Scene PlayNovelScenarioHarryAct1Chapter6Sub1Scene2 = { kFadeTypeNormal, kFadeTypeNormal, kSoundWrapperPlaybackNormal, - &MonsterSoundSound, - (PositionedEntity*)PlayNovelScenarioHarryAct1Chapter6Sub1Scene3Entities, + NULL, + (PositionedEntity*)PlayNovelScenarioHarryAct1Chapter6Sub1Scene2Entities, NULL, { { - "You have reached the end of this demo.", + "\"Ah...\"", + "And then my vitality is sucked away by these \nstrangely shaped monsters until I finally \nlose consciousness..." }, { } }, + &PlayNovelScenarioHarryAct1Chapter6Sub1Scene2BranchingTargets, }; const struct SubChapter PlayNovelScenarioHarryAct1Chapter6Sub1 = { @@ -106,7 +98,6 @@ const struct SubChapter PlayNovelScenarioHarryAct1Chapter6Sub1 = { { &PlayNovelScenarioHarryAct1Chapter6Sub1Scene1, &PlayNovelScenarioHarryAct1Chapter6Sub1Scene2, - &PlayNovelScenarioHarryAct1Chapter6Sub1Scene3, NULL, }, }; diff --git a/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter7.c b/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter7.c index 98b1e9c..942d9d0 100644 --- a/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter7.c +++ b/assets/Data/Script/Harry/Acts/1/Chapters/ScenarioHarryAct1Chapter7.c @@ -56,6 +56,7 @@ const struct Scene PlayNovelScenarioHarryAct1Chapter7Sub1Scene1 = { { } }, + NULL, }; PositionedEntityROMSpec PlayNovelScenarioHarryAct1Chapter7Sub1Scene2Entities[] = @@ -79,6 +80,7 @@ const struct Scene PlayNovelScenarioHarryAct1Chapter7Sub1Scene2 = { { } }, + NULL, }; PositionedEntityROMSpec PlayNovelScenarioHarryAct1Chapter7Sub1Scene3Entities[] = @@ -100,6 +102,7 @@ const struct Scene PlayNovelScenarioHarryAct1Chapter7Sub1Scene3 = { { } }, + NULL, }; const struct SubChapter PlayNovelScenarioHarryAct1Chapter7Sub1 = { diff --git a/source/states/VisualNovelState/VisualNovelState.c b/source/states/VisualNovelState/VisualNovelState.c index 48ef541..b80a04a 100644 --- a/source/states/VisualNovelState/VisualNovelState.c +++ b/source/states/VisualNovelState/VisualNovelState.c @@ -147,6 +147,12 @@ bool VisualNovelState::handleMessage(Telegram telegram) void VisualNovelState::nextPage() { + const struct BranchingTargets *branchingTargets = PlayNovelScenarios.scenarios[this->progress.scenario] + ->acts[this->progress.act]->chapters[this->progress.chapter] + ->subChapters[this->progress.subChapter] + ->scenes[this->progress.scene] + ->branchingTargets; + if (this->choicesMenuOptionCount > 0) { const struct Choices *choices = PlayNovelScenarios.scenarios[this->progress.scenario] ->acts[this->progress.act]->chapters[this->progress.chapter] @@ -174,8 +180,23 @@ void VisualNovelState::nextPage() ->scenes[this->progress.scene] ->text[this->language][this->progress.page] == NULL) { - this->progress.page = 0; - VisualNovelState::nextScene(this); + if (branchingTargets != NULL) + { + // TODO: iterate and check conditions + this->progress.act = branchingTargets->branchingTargets[0].target.act; + this->progress.chapter = branchingTargets->branchingTargets[0].target.chapter; + this->progress.subChapter = branchingTargets->branchingTargets[0].target.subChapter; + this->progress.scene = branchingTargets->branchingTargets[0].target.scene; + this->progress.page = 0; + + VisualNovelState::setUpScene(this); + VisualNovelState::saveProgress(this); + } + else + { + this->progress.page = 0; + VisualNovelState::nextScene(this); + } } } diff --git a/source/states/VisualNovelState/VisualNovelState.h b/source/states/VisualNovelState/VisualNovelState.h index dea97db..513d500 100644 --- a/source/states/VisualNovelState/VisualNovelState.h +++ b/source/states/VisualNovelState/VisualNovelState.h @@ -23,6 +23,7 @@ #define CHARACTER_DELAY 1 #define NUMBER_OF_LANGUAGES 2 #define MAX_CHOICES 3 +#define MAX_BRANCHING_TARGETS 3 //--------------------------------------------------------------------------------------------------------- @@ -62,6 +63,17 @@ typedef struct TargetPage uint16 scene; } TargetPage; +typedef struct BranchingTarget +{ + TargetPage target; + //TODO: conditions +} BranchingTarget; + +typedef struct BranchingTargets +{ + BranchingTarget branchingTargets[MAX_BRANCHING_TARGETS]; +} BranchingTargets; + typedef struct Choice { char* text[NUMBER_OF_LANGUAGES]; @@ -82,6 +94,7 @@ typedef struct Scene const PositionedEntity* positionedEntities; const Choices* choices; char* text[NUMBER_OF_LANGUAGES][MAX_TEXT_PER_SCENE]; + const BranchingTargets* branchingTargets; } Scene; typedef struct SubChapter