Tomb Raider 3 Used inventory slots nightmare

Add topics here with methods, analysis, code snippets, mods etc. for a certain game that normally won't make it in the Tables or Requests sections.
Post Reply
What is cheating?
What is cheating?
Posts: 3
Joined: Fri Jan 15, 2021 1:47 pm
Reputation: 4

Tomb Raider 3 Used inventory slots nightmare

Post by kliqx_dgcd »


I initially planned to do basically the same thing I did for Tomb Raider Chronicles for the third game.
BUT... before I upload it, I also want(ed) to add the ability to give and take weapons from Lara at any point, like with the TRC CT. The thing is, in TRC, it's easy enough to do this: change the RAM, save and reload the game and you've got your weapons.

TR3 does the absolute worst thing ever:
Basically, the address 004C6AF0 stores how many inventory spaces are used up. The horrible thing about this is that the 2-bytes for Flares, Big Medipacks and Small Medipacks (stored in that order, FYI) change position. The problem is that pointer scans and trying to find the pointer the "tutorial" way doesn't work. Nothing really seems to point to the addresses and the "offset" applied to the memory we're searching for depends solely on 004C6AF0.

After some more experimenting, I found that what's actually stored is the amount of 2-bytes that are skipped after (= not including) 004C6AF0, and that address is the one for the Flares. Basically, 004C6AF0 acts as a pointer, which stores how many weapon slots are needed to be skipped until the Flares 2-bytes, relative to itself... My brain absolutely couldn't handle that, BUT I did figure it out in the end.

The addresses for the three items in question are tomb3.exe+C6AF0+[tomb3.exe+C6AF0]*2+2, +4 and +6 respectively. First, go to the address tomb3.exe+C6AF0. Add the value of that address times 2. Go another 2 (4, 6) bytes forward.

What does this mean for writing to the respective weapon's 2-bytes? Not gonna happen. Somewhere, the game also keeps track of how many and, more importantly, which weapons we're supposed to have. Just editing 004C6AF0, shifting the 2-bytes for Flares and Medipacks and adding a 1 somewhere isn't enough, the game will just overwrite 004C6AF0 again and not give us the weapon.

Removing weapons, on the other hand, is pretty easy, because if it finds a 0 somewhere in the 2-bytes where it expects 1s, it'll just shift everything one forward, the weapon is gone and everything continues normally. It's just that absolutely nobody wants to remove weapons.
All the user gets the options to edit Flares, Big Medipacks, Small Medipacks and each weapon's ammo, the weapons themselves are out of the question for me.

How could I go about finding out where the game stores how many and which weapons Lara is supposed to have?

And how would I go about shifting values 2 bytes to the "right" through a script?
In pseudo-code, what I want to do is

Code: Select all

move 2bytes valueOf(F4) into F6
move 2bytes valueOf(F2) into F4
move 2bytes valueOf(F0) into F2
write 2bytes 19 into F0
P.S. I'm just hoping what I tried to describe isn't too confusing, I don't really know what I'm talking about here, I'm an absolute noob... I'm uploading the CT in its current state so people can experiment with it and maybe it'll help with understanding what I'm talking about. Just "Browse this memory region" of the entry "Used inventory slots" and you'll (hopefully) see what I was talking about.
tomb3 test.CT
(8.76 KiB) Downloaded 21 times

Table Makers
Table Makers
Posts: 642
Joined: Mon Mar 20, 2017 1:42 am
Reputation: 405

Re: Tomb Raider 3 Used inventory slots nightmare

Post by gideon25 »

Well, I only spent a few minutes with it, but I set the Used inventory slots to 10 at the beginning of the game and it gave me a lot of weapons (not all of them though). So I gave myself ammo for everything. I then switched weapons in the game (not the inventory) just with the normal number keys (NOT the ones on the number pad) and searched changed/unchanged, etc. and found a value that sets the a weapon number to the weapon laura draws into her hand. If you change it and you have the ammo she will draw and use the weapon even if its not in her inventory. I then set the hotkeys for the number keys according to the controls. Here you can add it to your table. Start a new game with no extra weapons and try it. Look at the table entry and right click set/Change hotkeys and you can change them to what you want. But I think they correspond to the official controls.
weapon switcher. numbers 1-8 will switch to each weapon as long as there is ammo--No weapon needed in inventory
(4.51 KiB) Downloaded 12 times

Post Reply

Who is online

Users browsing this forum: No registered users