safe LMB hold-to-skip cutscenes and multiple images with crossfade
This commit is contained in:
1 parent
fe01a5d1b2
commit
0a073243ad
16 files changed
+801
-58
No files matched your search
+42
-1
@@ -81,9 +81,11 @@ namespace ZL
|
||||
// so they are available immediately without waiting for resources.zip.
|
||||
renderer.shaderManager.AddShaderFromFiles("defaultColor", "resources/shaders/defaultColor.vertex", "resources/shaders/defaultColor_web.fragment", "");
|
||||
renderer.shaderManager.AddShaderFromFiles("default", "resources/shaders/default.vertex", "resources/shaders/default_web.fragment", "");
|
||||
renderer.shaderManager.AddShaderFromFiles("cutsceneFade", "resources/shaders/default.vertex", "resources/shaders/cutscene_fade_web.fragment", CONST_ZIP_FILE);
|
||||
#else
|
||||
renderer.shaderManager.AddShaderFromFiles("defaultColor", "resources/shaders/defaultColor.vertex", "resources/shaders/defaultColor_desktop.fragment", CONST_ZIP_FILE);
|
||||
renderer.shaderManager.AddShaderFromFiles("default", "resources/shaders/default.vertex", "resources/shaders/default_desktop.fragment", CONST_ZIP_FILE);
|
||||
renderer.shaderManager.AddShaderFromFiles("cutsceneFade", "resources/shaders/default.vertex", "resources/shaders/cutscene_fade_desktop.fragment", CONST_ZIP_FILE);
|
||||
#endif
|
||||
loadingTexture = std::make_unique<Texture>(CreateTextureDataFromPng("resources/loading.png", ""));
|
||||
|
||||
@@ -421,6 +423,24 @@ namespace ZL
|
||||
if (event.button.button == SDL_BUTTON_LEFT) {
|
||||
int mx = static_cast<int>((float)event.button.x / Environment::width * Environment::projectionWidth);
|
||||
int my = static_cast<int>((float)event.button.y / Environment::height * Environment::projectionHeight);
|
||||
|
||||
// Dialogue/cutscene input must be routed before UiManager and world picking.
|
||||
// Otherwise cutscene global hold-to-skip can be swallowed by regular UI handling.
|
||||
if (currentLocation && currentLocation->dialogueSystem.blocksGameplayInput()) {
|
||||
if (event.type == SDL_MOUSEBUTTONDOWN) {
|
||||
currentLocation->dialogueSystem.handlePointerDown(
|
||||
static_cast<float>(mx),
|
||||
Environment::projectionHeight - static_cast<float>(my)
|
||||
);
|
||||
}
|
||||
else {
|
||||
currentLocation->dialogueSystem.handlePointerReleased(
|
||||
static_cast<float>(mx),
|
||||
Environment::projectionHeight - static_cast<float>(my)
|
||||
);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (event.type == SDL_MOUSEBUTTONDOWN) {
|
||||
std::cout << "\n========== MOUSE DOWN EVENT ==========" << std::endl;
|
||||
@@ -464,11 +484,20 @@ namespace ZL
|
||||
else if (event.type == SDL_MOUSEMOTION) {
|
||||
int mx = static_cast<int>((float)event.motion.x / Environment::width * Environment::projectionWidth);
|
||||
int my = static_cast<int>((float)event.motion.y / Environment::height * Environment::projectionHeight);
|
||||
|
||||
if (currentLocation && currentLocation->dialogueSystem.blocksGameplayInput()) {
|
||||
currentLocation->dialogueSystem.handlePointerMoved(
|
||||
static_cast<float>(mx),
|
||||
Environment::projectionHeight - static_cast<float>(my)
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
handleMotion(ZL::UiManager::MOUSE_FINGER_ID, mx, my);
|
||||
if (currentLocation)
|
||||
{
|
||||
currentLocation->handleMotion(ZL::UiManager::MOUSE_FINGER_ID, event.motion.x, event.motion.y, mx, my);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.type == SDL_MOUSEWHEEL) {
|
||||
@@ -495,6 +524,18 @@ namespace ZL
|
||||
case SDLK_3:
|
||||
if (audioPlayer) audioPlayer->stopMusicAsync();
|
||||
break;
|
||||
case SDLK_7:
|
||||
currentLocation->dialogueSystem.startDialogue("test_cutscene_skip_hold_dialogue");
|
||||
break;
|
||||
case SDLK_8:
|
||||
currentLocation->dialogueSystem.startDialogue("test_cutscene_images_hardcut_dialogue");
|
||||
break;
|
||||
case SDLK_9:
|
||||
currentLocation->dialogueSystem.startDialogue("test_cutscene_images_crossfade_dialogue");
|
||||
break;
|
||||
case SDLK_0:
|
||||
currentLocation->dialogueSystem.startDialogue("test_cutscene_images_silent_dialogue");
|
||||
break;
|
||||
case SDLK_f:
|
||||
currentLocation->dialogueSystem.startDialogue("test_choice_dialogue");
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user