fix: dialogue text now displays correctly
This commit is contained in:
parent
7125674308
commit
6465549c3b
@ -1,128 +1,166 @@
|
||||
{
|
||||
"dialogues": [
|
||||
{
|
||||
"id": "npc_viola_intro",
|
||||
"displayName": "Ghost introduction",
|
||||
"start": "start",
|
||||
"id": "test_line_dialogue",
|
||||
"start": "line_1",
|
||||
"nodes": [
|
||||
{
|
||||
"id": "start",
|
||||
"id": "line_1",
|
||||
"type": "Line",
|
||||
"speaker": "Ghost",
|
||||
"portrait": "resources/w/ghost_skin001.png",
|
||||
"text": "So, you finally reached this room.",
|
||||
"next": "intro_choice"
|
||||
"portrait": "resources/ghost_avatar.png",
|
||||
"text": "You finally came here.",
|
||||
"next": "line_2"
|
||||
},
|
||||
{
|
||||
"id": "intro_choice",
|
||||
"id": "line_2",
|
||||
"type": "Line",
|
||||
"speaker": "Hero",
|
||||
"portrait": "",
|
||||
"text": "I need answers.",
|
||||
"next": "end_1"
|
||||
},
|
||||
{
|
||||
"id": "end_1",
|
||||
"type": "End"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"id": "test_choice_dialogue",
|
||||
"start": "line_1",
|
||||
"nodes": [
|
||||
{
|
||||
"id": "line_1",
|
||||
"type": "Line",
|
||||
"speaker": "Merchant",
|
||||
"portrait": "resources/ghost_avatar.png",
|
||||
"text": "What do you want?",
|
||||
"next": "choice_1"
|
||||
},
|
||||
{
|
||||
"id": "choice_1",
|
||||
"type": "Choice",
|
||||
"speaker": "Ghost",
|
||||
"portrait": "resources/w/ghost_skin001.png",
|
||||
"text": "Choose what Geralt says next.",
|
||||
"speaker": "Hero",
|
||||
"portrait": "",
|
||||
"text": "Choose your answer.",
|
||||
"choices": [
|
||||
{
|
||||
"id": "main_job",
|
||||
"id": "main_1",
|
||||
"kind": "Main",
|
||||
"text": "I am looking for answers.",
|
||||
"next": "job_line"
|
||||
"text": "Show me your goods.",
|
||||
"next": "line_goods"
|
||||
},
|
||||
{
|
||||
"id": "optional_who",
|
||||
"id": "optional_1",
|
||||
"kind": "Optional",
|
||||
"text": "Who are you?",
|
||||
"next": "who_line",
|
||||
"consumeOnce": true
|
||||
},
|
||||
{
|
||||
"id": "exit_now",
|
||||
"kind": "Exit",
|
||||
"text": "Enough. Goodbye.",
|
||||
"next": "end"
|
||||
"next": "line_who"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "who_line",
|
||||
"id": "line_goods",
|
||||
"type": "Line",
|
||||
"speaker": "Ghost",
|
||||
"portrait": "resources/w/ghost_skin001.png",
|
||||
"text": "Only a memory. But memories can still be dangerous.",
|
||||
"next": "intro_choice"
|
||||
"speaker": "Merchant",
|
||||
"portrait": "resources/ghost_avatar.png",
|
||||
"text": "Take a look.",
|
||||
"next": "end_1"
|
||||
},
|
||||
{
|
||||
"id": "job_line",
|
||||
"id": "line_who",
|
||||
"type": "Line",
|
||||
"speaker": "Ghost",
|
||||
"portrait": "resources/w/ghost_skin001.png",
|
||||
"text": "Then watch carefully. What follows is not a story, but a wound.",
|
||||
"next": "start_cutscene"
|
||||
"speaker": "Merchant",
|
||||
"portrait": "resources/ghost_avatar.png",
|
||||
"text": "Just a trader passing through.",
|
||||
"next": "end_1"
|
||||
},
|
||||
{
|
||||
"id": "start_cutscene",
|
||||
"type": "CutsceneStart",
|
||||
"cutsceneId": "ghost_memory_01",
|
||||
"next": "set_memory_seen"
|
||||
},
|
||||
"id": "end_1",
|
||||
"type": "End"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"id": "test_condition_dialogue",
|
||||
"start": "set_flag_1",
|
||||
"nodes": [
|
||||
{
|
||||
"id": "set_memory_seen",
|
||||
"id": "set_flag_1",
|
||||
"type": "SetFlag",
|
||||
"effects": [
|
||||
{
|
||||
"flag": "memory_seen",
|
||||
"value": 1
|
||||
}
|
||||
{ "flag": "met_ghost", "value": 1 }
|
||||
],
|
||||
"next": "after_cutscene_condition"
|
||||
"next": "condition_1"
|
||||
},
|
||||
{
|
||||
"id": "after_cutscene_condition",
|
||||
"id": "condition_1",
|
||||
"type": "Condition",
|
||||
"conditions": [
|
||||
{
|
||||
"flag": "memory_seen",
|
||||
"op": ">=",
|
||||
"value": 1
|
||||
}
|
||||
{ "flag": "met_ghost", "op": "Equals", "value": 1 }
|
||||
],
|
||||
"trueNext": "after_cutscene_line",
|
||||
"falseNext": "end"
|
||||
"trueNext": "line_true",
|
||||
"falseNext": "line_false"
|
||||
},
|
||||
{
|
||||
"id": "after_cutscene_line",
|
||||
"id": "line_true",
|
||||
"type": "Line",
|
||||
"speaker": "Ghost",
|
||||
"portrait": "resources/w/ghost_skin001.png",
|
||||
"text": "Now you know enough for the first quest hook.",
|
||||
"next": "end"
|
||||
"portrait": "resources/ghost_avatar.png",
|
||||
"text": "Now you know who I am.",
|
||||
"next": "end_1"
|
||||
},
|
||||
{
|
||||
"id": "end",
|
||||
"id": "line_false",
|
||||
"type": "Line",
|
||||
"speaker": "Ghost",
|
||||
"portrait": "resources/ghost_avatar.png",
|
||||
"text": "You should not hear this line.",
|
||||
"next": "end_1"
|
||||
},
|
||||
{
|
||||
"id": "end_1",
|
||||
"type": "End"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"id": "test_cutscene_dialogue",
|
||||
"start": "cutscene_start",
|
||||
"nodes": [
|
||||
{
|
||||
"id": "cutscene_start",
|
||||
"type": "CutsceneStart",
|
||||
"cutsceneId": "test_cutscene_01",
|
||||
"next": "end_1"
|
||||
},
|
||||
{
|
||||
"id": "end_1",
|
||||
"type": "End"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
"cutscenes": [
|
||||
{
|
||||
"id": "ghost_memory_01",
|
||||
"background": "resources/w/room005.png",
|
||||
"skippable": true,
|
||||
"id": "test_cutscene_01",
|
||||
"background": "resources/first_cutscene.png",
|
||||
"lines": [
|
||||
{
|
||||
"speaker": "Narrator",
|
||||
"text": "The room went silent, as if the walls remembered everything.",
|
||||
"durationMs": 2800
|
||||
"portrait": "",
|
||||
"text": "The air in the room turned cold.",
|
||||
"durationMs": 2200
|
||||
},
|
||||
{
|
||||
"speaker": "Ghost",
|
||||
"portrait": "resources/w/ghost_skin001.png",
|
||||
"text": "There were voices here once. Oaths. Smoke. Firelight.",
|
||||
"portrait": "resources/ghost_avatar.png",
|
||||
"text": "Some memories never fade.",
|
||||
"durationMs": 2600
|
||||
},
|
||||
{
|
||||
"speaker": "Narrator",
|
||||
"text": "Now there was only ash and a story that refused to die.",
|
||||
"durationMs": 2700
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
BIN
resources/first_cutscene.png
(Stored with Git LFS)
Normal file
BIN
resources/first_cutscene.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
resources/ghost_avatar.png
(Stored with Git LFS)
Normal file
BIN
resources/ghost_avatar.png
(Stored with Git LFS)
Normal file
Binary file not shown.
28
src/Game.cpp
28
src/Game.cpp
@ -231,7 +231,7 @@ namespace ZL
|
||||
dialogueSystem.loadDatabase("resources/dialogue/sample_dialogues.json");
|
||||
dialogueSystem.addTriggerZone({
|
||||
"ghost_room_trigger",
|
||||
"npc_viola_intro",
|
||||
"test_line_dialogue",
|
||||
Eigen::Vector3f(0.0f, 0.0f, -8.5f),
|
||||
2.0f,
|
||||
true,
|
||||
@ -248,13 +248,22 @@ namespace ZL
|
||||
{
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_FALSE);
|
||||
|
||||
renderer.shaderManager.PushShader(defaultShaderName);
|
||||
renderer.RenderUniform1i(textureUniformName, 0);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
menuManager.uiManager.draw(renderer);
|
||||
dialogueSystem.draw(renderer);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
renderer.shaderManager.PopShader();
|
||||
|
||||
glDepthMask(GL_TRUE);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
CheckGlError();
|
||||
}
|
||||
|
||||
@ -545,6 +554,23 @@ namespace ZL
|
||||
continue;
|
||||
}
|
||||
|
||||
if (event.type == SDL_KEYDOWN && event.key.repeat == 0) {
|
||||
switch (event.key.keysym.sym) {
|
||||
case SDLK_f:
|
||||
dialogueSystem.startDialogue("test_line_dialogue");
|
||||
break;
|
||||
|
||||
case SDLK_e:
|
||||
dialogueSystem.startDialogue("test_cutscene_dialogue");
|
||||
break;
|
||||
|
||||
case SDLK_RETURN:
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Обработка ввода текста
|
||||
if (event.type == SDL_KEYDOWN) {
|
||||
if (event.key.keysym.sym == SDLK_BACKSPACE) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user