Tomb Raider Forums  

Go Back   Tomb Raider Forums > Tomb Raider Level Editor and Modding > Tomb Raider Level Editor > Tomb Raider Next Generation

Reply
 
Thread Tools
Old 11-07-18, 19:00   #451
GabrielCroft
Member
 
GabrielCroft's Avatar
 
Joined: Dec 2009
Posts: 1,428
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
GabrielCroft is offline   Reply With Quote
Old 13-07-18, 18:22   #452
Titak
Moderator
 
Titak's Avatar
 
Joined: Jul 2003
Posts: 33,359
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.
Titak is offline   Reply With Quote
Old 03-10-18, 16:37   #453
AkyV
Moderator
 
Joined: Dec 2011
Posts: 4,881
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 online now   Reply With Quote
Old 03-10-18, 18:35   #454
JMN
Member
 
Joined: Sep 2006
Posts: 674
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
 
Joined: Dec 2011
Posts: 4,881
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 online now   Reply With Quote
Old 11-10-18, 14:09   #456
dcw123
Member
 
dcw123's Avatar
 
Joined: Nov 2007
Posts: 7,582
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
 
Joined: Dec 2011
Posts: 4,881
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 online now   Reply With Quote
Old 12-10-18, 09:32   #458
JMN
Member
 
Joined: Sep 2006
Posts: 674
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
 
Joined: Dec 2011
Posts: 4,881
Default

So the key is Ptr_VetSoundIndices this time.
Thank you. I'll try it soon.
AkyV is online now   Reply With Quote
Old 23-10-18, 15:54   #460
PhryneCroft
Member
 
PhryneCroft's Avatar
 
Joined: Feb 2018
Posts: 151
Default

Hello I have a question, LoreRaider has already given me some advice, but unfortunately I've already tried this. (With the Mapconverter2) I have a waterfall texture in 128x128 in my tga, I would like to animate it with the Animating range. (Did it like in the tutorial of Titka.) The problem is that it does not flow, it already has a flip effect tried, unfortunately, this doesn´t work. Unfortunately, I do not know any other advice. Can somebody help me with it? Thank you
PhryneCroft is offline   Reply With Quote
Reply

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 09:42.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Tomb Raider Forums is not owned or operated by CDE Entertainment Ltd.
Lara Croft and Tomb Raider are trademarks of CDE Entertainment Ltd.