www.tombraiderforums.com

Go Back   www.tombraiderforums.com > Tomb Raider Modding > Tomb Raider Level Editor > Next Generation Level Editor

Reply
 
Thread Tools
Old 11-07-18, 19:00   #451
GabrielCroft
Explorer
 
GabrielCroft's Avatar
 
Join Date: Dec 2009
Location: Brazil
Posts: 966
Default

Quote:
Originally Posted by LoreRaider View Post
^ Leikkuri is for TREP, not for TRNG
Yeah it's a shame... It would be awesome if Leikkuri was available for TRNG
__________________
"Isn't that what it's all about? Why we dig up the past? To understand it."
GabrielCroft is offline   Reply With Quote
Old 13-07-18, 18:22   #452
Titak
Moderator
 
Titak's Avatar
 
Join Date: Jul 2003
Location: Drenthe, The Netherlands
Posts: 31,466
Default

I used Leikkuri with Mists of Avalon - part 1.
So it works fine with that version of TRNG.
I am not using it anymore, so I do not know if it still works. If it works, it might only work with the tomb4.exe with the red icon. Just like with FLEP.
__________________
If it walks like a duck and if it quacks like a duck, it is a duck.
Titak is online now   Reply With Quote
Old 03-10-18, 16:37   #453
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 3,143
Default

How can I identify a route for a variable in the code, if I cannot find the "links"?

Just a random example, in the case of pDashBarValue:

Code:
typedef struct StrGlobAddress {

	StrItemTr4 *pLara;
	StrRoomTr4 *pVetRooms;
	StrItemTr4 *pVetItems;

	int *pTotItemsAtBegin;
	int *pTotItems; // era "AncoraTotItems"
	StrInventoryItems *pInventory;
        ...
	short *pDashBarValue;
	BYTE *pVetDrip;  
	WORD *pPoison1;
        ...
}GlobAddress;
It is in StrGlobAddress, which is referred with

Code:
typedef struct StrGlobaliTomb4 {
	StrBaseRemapMemory BaseRemap; // remapped memory zones in tomb4
	DWORD FlagsLevel;   // valore FL_...
	StrPrefTomb MyPrefTomb;
	StrBaseFog BaseFog;
        ...
	StrGlobAddress *pAdr;
	WORD ClimbFlags;
	StrEnvPosition EnvPosition;
        ...
So I can identify pAdr-> pDashBarValue.
Searching more in the way like this, the final route will be *Trng.pGlobTomb4->pAdr-> pDashBarValue.

But, for example I have this:

Code:
typedef struct StrSoundInfos {
	short Indice;
	BYTE Volume;
	BYTE RAD;   // valore originale
	BYTE CH;    // totale con 100 = 255
	char PIT;   // valori positivi o negativi con massimi (+/) 128 
	WORD Flags;  // FSI_
}SoundInfosFields;
There is no "link" to identify the route to StrSoundInfos variables! (Like "StrSoundInfos *pSoundInfos", or whatever else like this).
(StrZonaSound *pVetSfxSoundInfos is for another structure, as you can see.)
AkyV is offline   Reply With Quote
Old 03-10-18, 18:35   #454
JMN
Student
 
Join Date: Sep 2006
Location: South Africa
Posts: 143
Default

In such cases I think you'll need to "link" it yourself.

Each of those *variables are pointers to memory offsets where the actual data is stored. Paolone probably didn't think it was worth adding a pointer to that data or perhaps just missed it.

This will take a bit of digging through the assembly sources, but once you get comfortable with that it might open many more options for you.

Take a look at Tomb4Data.txt in the Tomb4Sources folder of the plugin sdk. At offset 7F7584 is the start of Ptr_VetSoundInfos which seems to be a pointer to a vector of structs:

Code:
7F7584: Ptr_VetSoundInfos:
To convert that to a vector of StrSoundInfos, you can do the following:

Code:
int *Ptr_VetSoundInfos = (int*)0x7F7584;

StrSoundInfos *pVetSoundInfos = (StrSoundInfos*)*Ptr_VetSoundInfos;
The count of sound infos seems to be at offset 7F70F0:

Code:
7F70F0: TotSoundInfos:
Converting to int:

Code:
int TotSoundInfos = *(int*)0x7F70F0;
Putting it all together gives you the following:

Code:
int *Ptr_VetSoundInfos = (int*)0x7F7584;

StrSoundInfos *pVetSoundInfos = (StrSoundInfos*)*Ptr_VetSoundInfos;

int TotSoundInfos = *(int*)0x7F70F0;

for (int i = 0; i < TotSoundInfos; ++i) {
    StrSoundInfos &SoundInfo = pVetSoundInfos[i];

    // turn up the volume!
    SoundInfo.Volume = 255;
	
    // and play every time
    SoundInfo.CH = 255;
}
JMN is offline   Reply With Quote
Old 03-10-18, 21:30   #455
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 3,143
Default

Quote:
Originally Posted by JMN View Post
Paolone probably didn't think it was worth adding a pointer to that data or perhaps just missed it.
I bet he missed it. I mean, he would not have created it if he'd thought it was not important.

Quote:
This will take a bit of digging through the assembly sources, but once you get comfortable with that it might open many more options for you.
Till now, I did that only with single variables (not being comfortable, only looking for some cases I wanted), but now I can see at last how should I do it with structures.


Quote:
Take a look at Tomb4Data.txt in the Tomb4Sources folder of the plugin sdk. At offset 7F7584 is the start of Ptr_VetSoundInfos which seems to be a pointer to a vector of structs:

Code:
7F7584: Ptr_VetSoundInfos:
To convert that to a vector of StrSoundInfos, you can do the following:
...
Thank you, basically I understand what you say here now, I will read it more seriously for the feature I want.
Plus, this method is something really important I learned today.
AkyV is offline   Reply With Quote
Old 11-10-18, 14:09   #456
dcw123
Relic Hunter
 
dcw123's Avatar
 
Join Date: Nov 2007
Location: England, UK Gender:Male
Posts: 6,341
Default

sorry guys, wrong thread NVM

Last edited by dcw123; 11-10-18 at 14:30.
dcw123 is offline   Reply With Quote
Old 11-10-18, 21:43   #457
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 3,143
Default

Quote:
Originally Posted by JMN View Post
The count of sound infos seems to be at offset 7F70F0:

Code:
7F70F0: TotSoundInfos:
Converting to int:

Code:
int TotSoundInfos = *(int*)0x7F70F0;
Level builders should understand notions like "relative index", "absolute index", "tomb4 (game) index", "NGLE (editor) index".
For example, if you have this order of rooms in the editor:

Room0
Room7
Room12

then in the game the empty slots will be ignored, so, the room list, in the same order, will be calculated with other indices in the game:

Room0
Room1
Room2

But I talk about sounds now.

TotSoundInfos refer to the "tomb4 indices" of sound groups (not sound samples!).
(IndiceRel in StrZonaSound can do something similar, but that notices a sound group only if one of the samples of the group is just playing and being heard.)

My problem is I'd like to know which is the NGLE ID of a required tomb4 sound group index.
I mean, builder cannot know the tomb4 sound indices, so I need to ask them to choose an NGLE sound index if they want to change eg. the volume of its sample(s) during the game. But sound properties seem to be defined only for tomb4 indices, not for NGLE indices.

So eg. this is what I need:
1. Builder chooses an NGLE sound group index. (It can be easily identified if they open the sound table from the drop down menu of NGLE.)
2. Engine converts it into tomb4 sound group index.
3. Engine changes the volume.

The problem is there is no converter like that. Convert function of Paolone is for Moveables, rooms, animations, frames etc., but not for sounds.

So the question is how can I identify in the code which NGLE sound group index refers to which tomb4 sound group index, and vice verse?
AkyV is offline   Reply With Quote
Old 12-10-18, 09:32   #458
JMN
Student
 
Join Date: Sep 2006
Location: South Africa
Posts: 143
Default

NGLE and tomb4 both use the same ID to refer to a given "sound group", e.g. 2 = LARA_NO. These IDs will stay the same for each level, i.e. 0-369.

What tomb4 does internally though is to keep an array containing only the infos for the sound groups present in the level, so a given ID won't match its index in the array except if all sounds are present. TotSoundInfos is just the size of this array.

This means to get the info for a given sound group, we have to map its ID to its index in the array. This is where the missing piece of the puzzle comes in, Ptr_VetSoundIndices.

The size of pVetSoundIndices is 370, so each entry corresponds to a sound group. Each value in the array contains the mapped index into the array of sound infos, i.e. pVetSoundInfos.

Using this mapped index we can then get the StrSoundInfos. If the index is less than 0 it means the sound is not present.

Sample code below:

Code:
int *Ptr_VetSoundIndices = (int*)0x7F7580;
short *pVetSoundIndices = (short*)*Ptr_VetSoundIndices;

int *Ptr_VetSoundInfos = (int*)0x7F7584;
StrSoundInfos *pVetSoundInfos = (StrSoundInfos*)*Ptr_VetSoundInfos;

// fixed sound ID for whole game in range 0-369, e.g. 2 = LARA_NO 
int SoundID = 29; // LARA_JUMP

// map fixed sound ID to level sound index
short SoundIndex = pVetSoundIndices[SoundID];

if (SoundIndex >= 0) { // -1 means not present, can also be -2
	StrSoundInfos &SoundInfo = pVetSoundInfos[SoundIndex];

	// turn up the volume!
	SoundInfo.Volume = 255;

	// and play every time
	SoundInfo.CH = 255;
}
Hope this helps. You can refer to this page for more detailed info:
https://trwiki.earvillage.net/doku.p...s:sound#sounds

Here SoundMap refers to pVetSoundIndices and SoundDetails to pVetSoundInfos

Last edited by JMN; 12-10-18 at 09:40.
JMN is offline   Reply With Quote
Old 12-10-18, 16:55   #459
AkyV
Moderator
 
Join Date: Dec 2011
Location: Hungary
Posts: 3,143
Default

So the key is Ptr_VetSoundIndices this time.
Thank you. I'll try it soon.
AkyV is offline   Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 12:54.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.