Mat-Allum wrote:
Fila wrote:
Well I got it to work... the noob way. lol
If you can briefly summarize how the tire loading code works, I might be able to offer some suggestions on how to make it more seamless. Without that information, I can at least mention that tracks have a string and two integers that are entirely ignored by the game (Locale and Latitude/Longitude) that could be interpreted any way we want, and perhaps the truck files may have some unused data fields as well that you could use? That way the patch would be able to pick up on the new tires and the old version would just ignore them.
How it reads:
1. A simple IF statement that looks at the .TRK file. If it detects a number 2 (in MTM2 Truckname) it switches to the MTM2 truck reading algorithm. If it doesn't, it switches to MTM1 reading algorithm.
2. It reads the values from the trk file, among them the base name of the wheel .bin name. Then inside the code it takes that base name and applies it to 16L.bin, 16R.bin etc and it just copies L and R for front axle and rear axle.
3. It further reads the location of the tires and sends them using pointers to the rendering engine (and it is clearly defined as left front, right front, rear left and rear right).
What I did:
I basically copy pasted the code from above into my own big IF statement where if it reads MTM2.1 Truckname it switches to my copy/pasted code that enables 4 different tires. If it doesn't detect 2.1 it switches to the default MTM2 code. So new trucks will have to be made using default 16L.bin and 16R.bin (and add 16RL.bin and 16RR.bin or whatever name I chose for the enhanced trucks) to keep it working with vanilla.
What I don't like about this is that the block of code that deals with reading the .bin files and then sends them to the rendering engine has like 40 lines of code and I basically added another 40 lines of code on top of that saying the same thing. It just looks ugly from a nerdy OCD programmer point of view.