1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-09-01 01:01:50 +02:00

fix inventory and saves

This commit is contained in:
XProger
2018-10-15 10:12:12 +03:00
parent 2b4cf9f83d
commit 5c1d84ee84
3 changed files with 13 additions and 11 deletions

View File

@@ -1827,7 +1827,7 @@ namespace TR {
} }
static bool isCrossLevelItem(Type type) { static bool isCrossLevelItem(Type type) {
return !isPuzzleItem(type) && !isKeyItem(type) && (type != LEADBAR); return isPickup(type) && !isPuzzleItem(type) && !isKeyItem(type) && (type != LEADBAR);
} }
bool isPickup() const { bool isPickup() const {

View File

@@ -909,8 +909,8 @@ struct Inventory {
if (key == cRight && item->value < 2) { item->value++; item->anim->dir = 1.0f; game->playSound(TR::SND_INV_PAGE); } if (key == cRight && item->value < 2) { item->value++; item->anim->dir = 1.0f; game->playSound(TR::SND_INV_PAGE); }
if (item->value != oldValue) { if (item->value != oldValue) {
slot = -1; slot = 0;
item->nextSlot(slot, 1); item->nextSlot(slot, -1);
} }
if (key == cAction && phaseChoose == 1.0f && item->value != 0) { if (key == cAction && phaseChoose == 1.0f && item->value != 0) {

View File

@@ -75,12 +75,12 @@ struct Level : IGame {
sndWater = sndTrack = NULL; sndWater = sndTrack = NULL;
Sound::stopAll(); Sound::stopAll();
if (loadSlot == -1 && !TR::isCutsceneLevel(level.id)) { if (!level.isTitle() && loadSlot == -1 && !TR::isCutsceneLevel(level.id)) {
// update statistics info for current level // update statistics info for current level
saveGame(false, true); saveGame(false, true);
// save next level // save next level
level.id = TR::getNextSaveLevel(level.id); // get next not cutscene level level.id = TR::getNextSaveLevel(level.id); // get next not cutscene level
if (level.id != TR::LVL_MAX) { if (level.id != TR::LVL_MAX && !level.isTitle()) {
memset(&level.levelStats, 0, sizeof(level.levelStats)); memset(&level.levelStats, 0, sizeof(level.levelStats));
saveGame(false, false); saveGame(false, false);
loadSlot = getSaveSlot(level.id, false); loadSlot = getSaveSlot(level.id, false);
@@ -267,15 +267,13 @@ struct Level : IGame {
if (saveResult == SAVE_RESULT_WAIT) if (saveResult == SAVE_RESULT_WAIT)
return; return;
saveResult = SAVE_RESULT_WAIT;
UI::showHint(STR_HINT_SAVING, 60.0f);
LOG("Save Game...\n"); LOG("Save Game...\n");
TR::LevelID id = level.id; TR::LevelID id = level.id;
SaveSlot slot; SaveSlot slot;
if (updateStats) { if (updateStats) {
removeSaveSlot(id, true);
int index = getSaveSlot(id, false); int index = getSaveSlot(id, false);
if (index == -1) { if (index == -1) {
slot = createSaveSlot(id, false, true); slot = createSaveSlot(id, false, true);
@@ -291,10 +289,14 @@ struct Level : IGame {
saveSlots.sort(); saveSlots.sort();
int size; if (!updateStats) {
uint8 *data = writeSaveSlots(size); saveResult = SAVE_RESULT_WAIT;
UI::showHint(STR_HINT_SAVING, 60.0f);
osWriteSlot(new Stream(SAVE_FILENAME, (const char*)data, size, saveGameWriteAsync, this)); int size;
uint8 *data = writeSaveSlots(size);
osWriteSlot(new Stream(SAVE_FILENAME, (const char*)data, size, saveGameWriteAsync, this));
}
} }
virtual void loadGame(int slot) { virtual void loadGame(int slot) {