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