1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-31 00:40:19 +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) {
return !isPuzzleItem(type) && !isKeyItem(type) && (type != LEADBAR);
return isPickup(type) && !isPuzzleItem(type) && !isKeyItem(type) && (type != LEADBAR);
}
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 (item->value != oldValue) {
slot = -1;
item->nextSlot(slot, 1);
slot = 0;
item->nextSlot(slot, -1);
}
if (key == cAction && phaseChoose == 1.0f && item->value != 0) {

View File

@@ -75,12 +75,12 @@ struct Level : IGame {
sndWater = sndTrack = NULL;
Sound::stopAll();
if (loadSlot == -1 && !TR::isCutsceneLevel(level.id)) {
if (!level.isTitle() && loadSlot == -1 && !TR::isCutsceneLevel(level.id)) {
// update statistics info for current level
saveGame(false, true);
// save next 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));
saveGame(false, false);
loadSlot = getSaveSlot(level.id, false);
@@ -267,15 +267,13 @@ struct Level : IGame {
if (saveResult == SAVE_RESULT_WAIT)
return;
saveResult = SAVE_RESULT_WAIT;
UI::showHint(STR_HINT_SAVING, 60.0f);
LOG("Save Game...\n");
TR::LevelID id = level.id;
SaveSlot slot;
if (updateStats) {
removeSaveSlot(id, true);
int index = getSaveSlot(id, false);
if (index == -1) {
slot = createSaveSlot(id, false, true);
@@ -291,10 +289,14 @@ struct Level : IGame {
saveSlots.sort();
int size;
uint8 *data = writeSaveSlots(size);
if (!updateStats) {
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) {