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

fix weapons ammo cheat

This commit is contained in:
XProger
2018-10-23 04:55:33 +03:00
parent d4f31f85c1
commit e2ef805034
2 changed files with 15 additions and 5 deletions

View File

@@ -646,9 +646,9 @@ struct Inventory {
if (level->version & TR::VER_TR1) {
add(TR::Entity::INV_PISTOLS, UNLIMITED_AMMO);
add(TR::Entity::INV_SHOTGUN, UNLIMITED_AMMO);
add(TR::Entity::INV_MAGNUMS, UNLIMITED_AMMO);
add(TR::Entity::INV_UZIS, UNLIMITED_AMMO);
add(TR::Entity::INV_SHOTGUN, 250);
add(TR::Entity::INV_MAGNUMS, 20);
add(TR::Entity::INV_UZIS, 100);
}
}
@@ -727,11 +727,14 @@ struct Inventory {
int i = contains(type);
if (i > -1) {
items[i]->count += count;
items[i]->count = min(UNLIMITED_AMMO, items[i]->count);
return;
}
ASSERT(itemsCount < INVENTORY_MAX_ITEMS);
count = min(UNLIMITED_AMMO, count);
Item *newItem = new Item(game->getLevel(), type, count);
if (newItem->desc.model == -1) {
delete newItem;

View File

@@ -24,6 +24,10 @@
extern void loadLevelAsync(Stream *stream, void *userData);
extern Array<SaveSlot> saveSlots;
extern SaveResult saveResult;
extern int loadSlot;
struct Level : IGame {
TR::Level level;
@@ -282,7 +286,9 @@ struct Level : IGame {
saveSlots.push(slot);
} else
slot = saveSlots[index];
*(SaveStats*)slot.data = saveStats;
SaveStats *stats = (SaveStats*)slot.data;
stats->level = level.id;
stats->checkpoint = checkpoint;
} else {
removeSaveSlot(id, checkpoint); // remove checkpoints and level saves
saveSlots.push(createSaveSlot(id, checkpoint));
@@ -855,6 +861,7 @@ struct Level : IGame {
camera->doCutscene(lara->pos, lara->angle.y);
}
*/
if (!level.isCutsceneLevel()) {
inventory->reset(this);
memset(&saveStats, 0, sizeof(saveStats));