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:
@@ -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 {
|
||||||
|
@@ -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) {
|
||||||
|
18
src/level.h
18
src/level.h
@@ -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) {
|
||||||
|
Reference in New Issue
Block a user