1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-16 18:14:05 +02:00

#11 fix black background on first inventory toggle

This commit is contained in:
XProger
2017-12-17 17:02:40 +03:00
parent c805780715
commit b1c619c9be
2 changed files with 9 additions and 3 deletions

View File

@@ -368,6 +368,8 @@ struct Inventory {
} }
bool toggle(Page curPage = PAGE_INVENTORY, TR::Entity::Type type = TR::Entity::LARA) { bool toggle(Page curPage = PAGE_INVENTORY, TR::Entity::Type type = TR::Entity::LARA) {
titleTimer = 0.0f;
if (phaseRing == 0.0f || phaseRing == 1.0f) { if (phaseRing == 0.0f || phaseRing == 1.0f) {
active = !active; active = !active;
vec3 p; vec3 p;
@@ -751,7 +753,7 @@ struct Inventory {
return false; return false;
} }
void prepareBackground() { Texture* getBackgroundTarget() {
if (background[0] && (background[0]->origWidth != INVENTORY_BG_SIZE || background[0]->origHeight != INVENTORY_BG_SIZE)) { if (background[0] && (background[0]->origWidth != INVENTORY_BG_SIZE || background[0]->origHeight != INVENTORY_BG_SIZE)) {
delete background[0]; delete background[0];
background[0] = NULL; background[0] = NULL;
@@ -761,6 +763,10 @@ struct Inventory {
if (!background[i]) if (!background[i])
background[i] = new Texture(INVENTORY_BG_SIZE, INVENTORY_BG_SIZE, Texture::RGBA, false); background[i] = new Texture(INVENTORY_BG_SIZE, INVENTORY_BG_SIZE, Texture::RGBA, false);
return background[0];
}
void prepareBackground() {
Core::setDepthTest(false); Core::setDepthTest(false);
Core::setBlending(bmNone); Core::setBlending(bmNone);

View File

@@ -1250,7 +1250,7 @@ struct Level : IGame {
} }
} }
if (Input::state[cInventory] && !level.isTitle()) { if (Input::state[cInventory] && !level.isTitle() && inventory.titleTimer < 1.0f) {
if (lara->health <= 0.0f) if (lara->health <= 0.0f)
inventory.toggle(Inventory::PAGE_OPTION, TR::Entity::INV_PASSPORT); inventory.toggle(Inventory::PAGE_OPTION, TR::Entity::INV_PASSPORT);
else else
@@ -1936,7 +1936,7 @@ struct Level : IGame {
} }
if (copyBg) { if (copyBg) {
Core::defaultTarget = inventory.background[0]; Core::defaultTarget = inventory.getBackgroundTarget();
bool stereo = Core::settings.detail.stereo; bool stereo = Core::settings.detail.stereo;
Core::settings.detail.stereo = false; Core::settings.detail.stereo = false;
renderGame(); renderGame();