Tomb Raider 3 Used inventory slots nightmare
Posted: Tue Feb 02, 2021 5:31 pm
Hi!
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
After some more experimenting, I found that what's actually stored is the amount of 2-bytes that are skipped after (= not including)
The addresses for the three items in question are
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
Removing weapons, on the other hand, is pretty easy, because if it finds a
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
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.
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 1
s, 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