Working with phone and time
This commit is contained in:
parent
c8d743b932
commit
59e0b2d77a
@ -33,13 +33,33 @@
|
||||
},
|
||||
{
|
||||
"type": "StaticImage",
|
||||
"name": "phoneTime",
|
||||
"name": "phoneTimeDay",
|
||||
"horizontal_gravity": "center",
|
||||
"vertical_gravity": "top",
|
||||
"y": 120,
|
||||
"width": 446.25,
|
||||
"height": 120.4,
|
||||
"texture": "resources/w/ui/img/phone2/ClockDay001.png"
|
||||
},
|
||||
{
|
||||
"type": "StaticImage",
|
||||
"name": "phoneTimeNight",
|
||||
"horizontal_gravity": "center",
|
||||
"vertical_gravity": "top",
|
||||
"y": 120,
|
||||
"width": 446.25,
|
||||
"height": 120.4,
|
||||
"texture": "resources/w/ui/img/phone2/ClockNight001.png"
|
||||
},
|
||||
{
|
||||
"type": "StaticImage",
|
||||
"name": "phoneTimeDawn",
|
||||
"horizontal_gravity": "center",
|
||||
"vertical_gravity": "top",
|
||||
"y": 120,
|
||||
"width": 446.25,
|
||||
"height": 120.4,
|
||||
"texture": "resources/w/ui/img/phone2/ClockMorning001.png"
|
||||
},
|
||||
{
|
||||
"type": "Button",
|
||||
|
||||
22
src/Game.cpp
22
src/Game.cpp
@ -271,7 +271,7 @@ namespace ZL
|
||||
locations["uni_interior"]->setup(uniInteriorParams, &menuManager.questJournal);
|
||||
locations["uni_interior"]->scriptEngine.setGlobalStore(&globalInts);
|
||||
locations["uni_interior"]->scriptEngine.setGlobalFloatStore(&globalFloats);
|
||||
locations["uni_interior"]->requestNightDayTransition = [this](bool isNight, bool isDawn) { this->isNight = isNight; this->isDawn = isDawn; };
|
||||
locations["uni_interior"]->requestNightDayTransition = [this](bool isNight, bool isDawn) { this->menuManager.isNight = isNight; this->menuManager.isDawn = isDawn; };
|
||||
locations["uni_interior"]->requestDarklandsTransition = [this]() { return startDarklandsTransition(); };
|
||||
locations["uni_interior"]->requestAdvanceDarklandsHud = [this]() { menuManager.advanceUniIntDarklandsHud(); };
|
||||
if (locations["uni_interior"]->player)
|
||||
@ -300,7 +300,7 @@ namespace ZL
|
||||
locations["uni_exterior"]->setup(uniExteriorParams, &menuManager.questJournal);
|
||||
locations["uni_exterior"]->scriptEngine.setGlobalStore(&globalInts);
|
||||
locations["uni_exterior"]->scriptEngine.setGlobalFloatStore(&globalFloats);
|
||||
locations["uni_exterior"]->requestNightDayTransition = [this](bool isNight, bool isDawn) { this->isNight = isNight; this->isDawn = isDawn; };
|
||||
locations["uni_exterior"]->requestNightDayTransition = [this](bool isNight, bool isDawn) { this->menuManager.isNight = isNight; this->menuManager.isDawn = isDawn; };
|
||||
locations["uni_exterior"]->requestDarklandsTransition = [this]() { return startDarklandsTransition(); };
|
||||
if (locations["uni_exterior"]->player)
|
||||
locations["uni_exterior"]->player->onDeathAnimComplete = [this]() { startDarklandsTransition(); };
|
||||
@ -363,7 +363,7 @@ namespace ZL
|
||||
locations["location_dorm"]->setup(params_dorm, &menuManager.questJournal);
|
||||
locations["location_dorm"]->scriptEngine.setGlobalStore(&globalInts);
|
||||
locations["location_dorm"]->scriptEngine.setGlobalFloatStore(&globalFloats);
|
||||
locations["location_dorm"]->requestNightDayTransition = [this](bool isNight, bool isDawn) { this->isNight = isNight; this->isDawn = isDawn; };
|
||||
locations["location_dorm"]->requestNightDayTransition = [this](bool isNight, bool isDawn) { this->menuManager.isNight = isNight; this->menuManager.isDawn = isDawn; };
|
||||
locations["location_dorm"]->requestDarklandsTransition = [this]() { return startDarklandsTransition(); };
|
||||
if (locations["location_dorm"]->player)
|
||||
locations["location_dorm"]->player->onDeathAnimComplete = [this]() { startDarklandsTransition(); };
|
||||
@ -537,14 +537,14 @@ namespace ZL
|
||||
{
|
||||
// Sync global flags so Location's draw functions see them.
|
||||
currentLocation->isDarklands = isDarklands;
|
||||
currentLocation->isNight = isNight;
|
||||
currentLocation->isDawn = isDawn;
|
||||
currentLocation->isNight = menuManager.isNight;
|
||||
currentLocation->isDawn = menuManager.isDawn;
|
||||
|
||||
if (isDarklands) {
|
||||
currentLocation->drawGameDarklands();
|
||||
CheckGlError(__FILE__, __LINE__);
|
||||
}
|
||||
else if (isNight) {
|
||||
else if (menuManager.isNight) {
|
||||
currentLocation->drawGameNight();
|
||||
CheckGlError(__FILE__, __LINE__);
|
||||
}
|
||||
@ -752,18 +752,18 @@ namespace ZL
|
||||
if (editorMode == EditorMode::InteractiveObjects && currentLocation) {
|
||||
currentLocation->editor.selectInteractiveObject(8);
|
||||
} else {
|
||||
isDawn = !isDawn;
|
||||
if (isDawn) isNight = true;
|
||||
menuManager.isDawn = !menuManager.isDawn;
|
||||
if (menuManager.isDawn) menuManager.isNight = true;
|
||||
}
|
||||
break;
|
||||
case SDLK_9:
|
||||
if (editorMode == EditorMode::InteractiveObjects && currentLocation) {
|
||||
currentLocation->editor.selectInteractiveObject(9);
|
||||
} else {
|
||||
if (isDawn) {
|
||||
isDawn = false; // step back: dawn → plain night
|
||||
if (menuManager.isDawn) {
|
||||
menuManager.isDawn = false; // step back: dawn → plain night
|
||||
} else {
|
||||
isNight = !isNight;
|
||||
menuManager.isNight = !menuManager.isNight;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -52,10 +52,6 @@ namespace ZL {
|
||||
// Returns false if a transition is already in progress.
|
||||
bool startDarklandsTransition();
|
||||
|
||||
// Global night mode state — persists across location transitions.
|
||||
bool isNight = false;
|
||||
bool isDawn = false; // sub-variant of night: brighter pink ambient, same lighting
|
||||
|
||||
Inventory inventory;
|
||||
InteractiveObject* pickedUpObject = nullptr;
|
||||
|
||||
|
||||
@ -301,6 +301,28 @@ namespace ZL {
|
||||
uiManager.setButtonCallback("phoneTaxi", [this](const std::string&) {
|
||||
openPhoneTaxi();
|
||||
});
|
||||
|
||||
if (isNight)
|
||||
{
|
||||
if (isDawn)
|
||||
{
|
||||
uiManager.setNodeVisible("phoneTimeDay", false);
|
||||
uiManager.setNodeVisible("phoneTimeNight", false);
|
||||
uiManager.setNodeVisible("phoneTimeDawn", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
uiManager.setNodeVisible("phoneTimeDay", false);
|
||||
uiManager.setNodeVisible("phoneTimeNight", true);
|
||||
uiManager.setNodeVisible("phoneTimeDawn", false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uiManager.setNodeVisible("phoneTimeDay", true);
|
||||
uiManager.setNodeVisible("phoneTimeNight", false);
|
||||
uiManager.setNodeVisible("phoneTimeDawn", false);
|
||||
}
|
||||
}
|
||||
|
||||
void MenuManager::openPhoneMessenger() {
|
||||
|
||||
@ -36,6 +36,11 @@ namespace ZL {
|
||||
UiManager uiManager;
|
||||
ZL::Quest::QuestJournal questJournal;
|
||||
|
||||
// Global night mode state — persists across location transitions.
|
||||
bool isNight = false;
|
||||
bool isDawn = false; // sub-variant of night: brighter pink ambient, same lighting
|
||||
|
||||
|
||||
MenuManager(Renderer& iRenderer);
|
||||
|
||||
void setup(Inventory& inv, const std::string& zipFile);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user