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:
@@ -646,9 +646,9 @@ struct Inventory {
|
|||||||
|
|
||||||
if (level->version & TR::VER_TR1) {
|
if (level->version & TR::VER_TR1) {
|
||||||
add(TR::Entity::INV_PISTOLS, UNLIMITED_AMMO);
|
add(TR::Entity::INV_PISTOLS, UNLIMITED_AMMO);
|
||||||
add(TR::Entity::INV_SHOTGUN, UNLIMITED_AMMO);
|
add(TR::Entity::INV_SHOTGUN, 250);
|
||||||
add(TR::Entity::INV_MAGNUMS, UNLIMITED_AMMO);
|
add(TR::Entity::INV_MAGNUMS, 20);
|
||||||
add(TR::Entity::INV_UZIS, UNLIMITED_AMMO);
|
add(TR::Entity::INV_UZIS, 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -727,11 +727,14 @@ struct Inventory {
|
|||||||
int i = contains(type);
|
int i = contains(type);
|
||||||
if (i > -1) {
|
if (i > -1) {
|
||||||
items[i]->count += count;
|
items[i]->count += count;
|
||||||
|
items[i]->count = min(UNLIMITED_AMMO, items[i]->count);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(itemsCount < INVENTORY_MAX_ITEMS);
|
ASSERT(itemsCount < INVENTORY_MAX_ITEMS);
|
||||||
|
|
||||||
|
count = min(UNLIMITED_AMMO, count);
|
||||||
|
|
||||||
Item *newItem = new Item(game->getLevel(), type, count);
|
Item *newItem = new Item(game->getLevel(), type, count);
|
||||||
if (newItem->desc.model == -1) {
|
if (newItem->desc.model == -1) {
|
||||||
delete newItem;
|
delete newItem;
|
||||||
|
11
src/level.h
11
src/level.h
@@ -24,6 +24,10 @@
|
|||||||
|
|
||||||
extern void loadLevelAsync(Stream *stream, void *userData);
|
extern void loadLevelAsync(Stream *stream, void *userData);
|
||||||
|
|
||||||
|
extern Array<SaveSlot> saveSlots;
|
||||||
|
extern SaveResult saveResult;
|
||||||
|
extern int loadSlot;
|
||||||
|
|
||||||
struct Level : IGame {
|
struct Level : IGame {
|
||||||
|
|
||||||
TR::Level level;
|
TR::Level level;
|
||||||
@@ -191,7 +195,7 @@ struct Level : IGame {
|
|||||||
|
|
||||||
// level progress stats
|
// level progress stats
|
||||||
if (slot.isCheckpoint())
|
if (slot.isCheckpoint())
|
||||||
saveStats = *(SaveStats*)ptr; // start level current position
|
saveStats = *(SaveStats*)ptr; // start level current position
|
||||||
|
|
||||||
ptr += sizeof(saveStats);
|
ptr += sizeof(saveStats);
|
||||||
|
|
||||||
@@ -282,7 +286,9 @@ struct Level : IGame {
|
|||||||
saveSlots.push(slot);
|
saveSlots.push(slot);
|
||||||
} else
|
} else
|
||||||
slot = saveSlots[index];
|
slot = saveSlots[index];
|
||||||
*(SaveStats*)slot.data = saveStats;
|
SaveStats *stats = (SaveStats*)slot.data;
|
||||||
|
stats->level = level.id;
|
||||||
|
stats->checkpoint = checkpoint;
|
||||||
} else {
|
} else {
|
||||||
removeSaveSlot(id, checkpoint); // remove checkpoints and level saves
|
removeSaveSlot(id, checkpoint); // remove checkpoints and level saves
|
||||||
saveSlots.push(createSaveSlot(id, checkpoint));
|
saveSlots.push(createSaveSlot(id, checkpoint));
|
||||||
@@ -855,6 +861,7 @@ struct Level : IGame {
|
|||||||
camera->doCutscene(lara->pos, lara->angle.y);
|
camera->doCutscene(lara->pos, lara->angle.y);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!level.isCutsceneLevel()) {
|
if (!level.isCutsceneLevel()) {
|
||||||
inventory->reset(this);
|
inventory->reset(this);
|
||||||
memset(&saveStats, 0, sizeof(saveStats));
|
memset(&saveStats, 0, sizeof(saveStats));
|
||||||
|
Reference in New Issue
Block a user