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