Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Tiberian Technologies / Blackhand Studios » Tiberian Technologies Forum » Vehicle WEAPON names no longer shows up
Vehicle WEAPON names no longer shows up [message #487407] Tue, 29 April 2014 08:41 Go to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3805
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
More details below.
3.4.4:
index.php?t=getfile&id=14929&private=0
index.php?t=getfile&id=14930&private=0
4.0
index.php?t=getfile&id=14932&private=0
index.php?t=getfile&id=14931&private=0
I've changed this string several times and even set it on the weapon definition (just in case you guys changed how it was set) but nothing seems to work. However other changes I have been making are persisting (I changed the vehicle weapon and that came across as well as other health and engine changes). I've also tried using different strings but nothing seems to be change the weapon name in game, it definitely doesn't seem to work as it did in stock Renegade.
  • Attachment: Picture0.png
    (Size: 1.28MB, Downloaded 492 times)
  • Attachment: Picture1.png
    (Size: 80.25KB, Downloaded 473 times)
  • Attachment: Picture2.png
    (Size: 90.96KB, Downloaded 497 times)
  • Attachment: Picture3.png
    (Size: 774.47KB, Downloaded 479 times)


Re: Vehicle WEAPON names no longer shows up [message #487412 is a reply to message #487407] Tue, 29 April 2014 09:20 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
VehicleNameID should be the string that is shown when you point your crosshairs at the vehicle from outside, the weapon name should come from the weapon definition as I recall.

http://steamsignature.com/card/1/76561197975867233.png
Re: Vehicle WEAPON names no longer shows up [message #487413 is a reply to message #487412] Tue, 29 April 2014 10:30 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3805
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
danpaul88 wrote on Tue, 29 April 2014 10:20

VehicleNameID should be the string that is shown when you point your crosshairs at the vehicle from outside, the weapon name should come from the weapon definition as I recall.

Vehicle->TranslatedNameID is what a vehicle gets its name from.
Weapon->IconNameID is what normal infantry weapons get their name from.
Vehicle->VehicleNameID is what used to show up as the vehicle's weapon name prior to 4.X at least.

Now it seems none of these affect the vehicle weapon name.


Re: Vehicle WEAPON names no longer shows up [message #487417 is a reply to message #487407] Tue, 29 April 2014 12:11 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Using scripts.dll 4.1;

index.php?t=getfile&id=14933&private=0

So it obviously is possible still... don't have LE on me at the moment to check where that comes from though


http://steamsignature.com/card/1/76561197975867233.png
Re: Vehicle WEAPON names no longer shows up [message #487420 is a reply to message #487417] Tue, 29 April 2014 14:06 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3805
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
danpaul88 wrote on Tue, 29 April 2014 13:11

Using scripts.dll 4.1;

index.php?t=getfile&id=14933&private=0

So it obviously is possible still... don't have LE on me at the moment to check where that comes from though

Maybe its just a bug with temps? Because I can say with 95% certainty in original 3.4.4 it was set by VehicleNameID (as I had to do it about 30 times at least for Rp2)...

Or perhaps it only works if it was set in the old LE, maybe it was disconnected from the correct value in 4.X's LE?


[Updated on: Tue, 29 April 2014 14:10]

Report message to a moderator

Re: Vehicle WEAPON names no longer shows up [message #487421 is a reply to message #487407] Tue, 29 April 2014 14:35 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
In AR we have;

Weapon;
- IconNameID: None

Vehicle;
- TranslatedNameID: IDS_Vehic_Soviet_ApocTank_Name
- VehicleNameID: IDS_Vehic_Weap_Soviet_Apocalypse_Tank


So why it's not working for you I don't know, but it certainly works for us using those fields. I even tried changing it and the change was replicated ingame... maybe make 100% sure the IconNameID is set to None (ie: blank) rather than any value? Maybe that overrides it somehow.


http://steamsignature.com/card/1/76561197975867233.png
Re: Vehicle WEAPON names no longer shows up [message #487422 is a reply to message #487407] Tue, 29 April 2014 16:53 Go to previous messageGo to next message
jonwil is currently offline  jonwil
Messages: 3555
Registered: February 2003
Karma: 0
General (3 Stars)

I dont know why it wouldn't be working either.
The hud code is using VehicleGameObj::Get_Vehicle_Name (in engine_tdb.cpp) when it displays the name.


Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
Re: Vehicle WEAPON names no longer shows up [message #487424 is a reply to message #487421] Wed, 30 April 2014 06:34 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3805
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
danpaul88 wrote on Tue, 29 April 2014 15:35


So why it's not working for you I don't know, but it certainly works for us using those fields. I even tried changing it and the change was replicated ingame... maybe make 100% sure the IconNameID is set to None (ie: blank) rather than any value? Maybe that overrides it somehow.

I gave that a try just in case it started to, however it doesn't do the trick.

I also copied the settings of the weapon and vehicle preset 1:1 from ECW to this Renegade map just to make sure some setting wasn't the issue, no luck.

As a quick note, this is using mapname.ddb and the strings_map.tbl; just in case either of those two things aren't being correctly read or something?

Also I didn't think to look last night when I was on the FDS, maybe this is something that isn't working while on single player LAN? (I did notice that the info on the loading screen only updates when connected via internet).


Re: Vehicle WEAPON names no longer shows up [message #487425 is a reply to message #487407] Wed, 30 April 2014 06:44 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
The screenshot I showed was from single player LAN

http://steamsignature.com/card/1/76561197975867233.png
Re: Vehicle WEAPON names no longer shows up [message #487426 is a reply to message #487425] Wed, 30 April 2014 06:51 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3805
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
danpaul88 wrote on Wed, 30 April 2014 07:44

The screenshot I showed was from single player LAN

Well then it must have something to do with map specific temps or strings?


Re: Vehicle WEAPON names no longer shows up [message #487427 is a reply to message #487407] Wed, 30 April 2014 06:54 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Hmm, looking in the code I noticed something a bit... odd...

const wchar_t *VehicleGameObj::Get_Vehicle_Name()
{
  if (( Get_Definition().VehicleNameID != 0 ) && (Get_Definition().VehicleNameID < TranslateDBClass::Get_Object_Count())) {
   return TranslateDBClass::Get_String( Get_Definition().VehicleNameID );
  }
  return TRANSLATE(12648);
}



It is checking the ID against the number of entries in the translation table... but I believe it is perfectly valid and, in fact, expected, for there to be gaps in the table so the highest indexes would be > the count of entries in the table, resulting in it failing that check. What's your take on that jonwil?

It could be that is the source of the bug, try using a string with a low ID and see if that shows up properly to prove it out.


The extra check was added in commit c4ce60fa629cbdaebc3a2e825f8d67c8391d9dc2 in 2009, apparently to fix an FDS bug, so that explains why it's not an issue in 3.4.4




It's also worth checking out BeaconGameObj.cpp (line 475) and tdbedit.cpp (line 92) as those also appear to check an ID against the number of entries in the translation database...


http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Wed, 30 April 2014 07:01]

Report message to a moderator

Re: Vehicle WEAPON names no longer shows up [message #487428 is a reply to message #487427] Wed, 30 April 2014 07:27 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3805
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
So I selected ID 1000 in my strings_map.tbl:

#define IDS_M00AVIS_KICK0050I1CCCK_TXT 1000
tada
index.php?t=getfile&id=14934&private=0

As a warning, this is a new map that I just started making 3 weeks ago, no saying that this isn't an issue with my strings file (although vehicle name changes fine to whatever I select, its only the weapon name having issues).
  • Attachment: Untitled.png
    (Size: 653.04KB, Downloaded 315 times)


Re: Vehicle WEAPON names no longer shows up [message #487429 is a reply to message #487407] Wed, 30 April 2014 07:30 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
No, I think it is a bug as outlined above, the ID isn't an index within the database and can be non-sequential so comparing it against the object count is flawed logic.

http://steamsignature.com/card/1/76561197975867233.png
Re: Vehicle WEAPON names no longer shows up [message #487430 is a reply to message #487407] Wed, 30 April 2014 07:50 Go to previous messageGo to next message
iRANian is currently offline  iRANian
Messages: 4299
Registered: April 2011
Karma: 0
General (4 Stars)
That's some really odd code, comparing against the total object count. Why was it introduced? You mentioned something to do with the FDS in 2009.

Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases
Re: Vehicle WEAPON names no longer shows up [message #487431 is a reply to message #487407] Wed, 30 April 2014 08:12 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Jonwil added it in 2009 with a comment about fixing a bug in the FDS along with a bunch of other changes, presumably it was hitting some invalid indexes somewhere which did bad things but the change would appear to have some flawed logic. You'd have to ask him what exactly it was fixing but I suspect that, given it was 5 years ago, he probably won't remember.

http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Wed, 30 April 2014 08:18]

Report message to a moderator

Re: Vehicle WEAPON names no longer shows up [message #487432 is a reply to message #487431] Wed, 30 April 2014 09:42 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3805
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
danpaul88 wrote on Wed, 30 April 2014 09:12

Jonwil added it in 2009 with a comment about fixing a bug in the FDS along with a bunch of other changes, presumably it was hitting some invalid indexes somewhere which did bad things but the change would appear to have some flawed logic. You'd have to ask him what exactly it was fixing but I suspect that, given it was 5 years ago, he probably won't remember.

I'm pretty sure if the FDS tries to grab a non-existent string ID it just crashes; or at least that's what I've seen in the past.


Re: Vehicle WEAPON names no longer shows up [message #487435 is a reply to message #487407] Wed, 30 April 2014 13:44 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
A bit silly since clients actually handle it fairly gracefully by substituting the TDBERR string...

http://steamsignature.com/card/1/76561197975867233.png
Re: Vehicle WEAPON names no longer shows up [message #487436 is a reply to message #487407] Wed, 30 April 2014 14:58 Go to previous messageGo to next message
jonwil is currently offline  jonwil
Messages: 3555
Registered: February 2003
Karma: 0
General (3 Stars)

I cant remember why I made the change.
Based on a reading of TranslateDBClass::Find_Object(uint32 id) in TranslateDBClass.h and other stuff in TranslateDBClass.h, the correct way to do what I was doing would have been to do something like this:

const wchar_t *VehicleGameObj::Get_Vehicle_Name()
{
	if (( Get_Definition().VehicleNameID != 0 ) && (Get_Definition().VehicleNameID-1000 < TranslateDBClass::Get_Object_Count())) {
		return TranslateDBClass::Get_String( Get_Definition().VehicleNameID );
	}
	return TRANSLATE(12648);
}


In the case of BeaconGameObj.cpp, its correctly subtracting 1000 (aka ID_MIN) before doing the comparison.
Checking tdbedit, it looks like Goto in tdbedit.cpp (based on the things that call it) is supposed to take an index into the TranslateDBClass array and therefore is doing what it should be doing.

So in theory if you make sure that there is a string with an ID that's at least 1000 more than the IDs you are using for your weapon strings, it SHOULD work. (hence why it works for other people)

As for an actual fix, I will commit a fix to 5.0 (where work is going forward) and to 4.2 (our stable branch) but we wont be releasing a fix for 4.1 at this time.


Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
Re: Vehicle WEAPON names no longer shows up [message #487437 is a reply to message #487436] Wed, 30 April 2014 21:43 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3805
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
jonwil wrote on Wed, 30 April 2014 15:58

I cant remember why I made the change.
Based on a reading of TranslateDBClass::Find_Object(uint32 id) in TranslateDBClass.h and other stuff in TranslateDBClass.h, the correct way to do what I was doing would have been to do something like this:

const wchar_t *VehicleGameObj::Get_Vehicle_Name()
{
	if (( Get_Definition().VehicleNameID != 0 ) && (Get_Definition().VehicleNameID-1000 < TranslateDBClass::Get_Object_Count())) {
		return TranslateDBClass::Get_String( Get_Definition().VehicleNameID );
	}
	return TRANSLATE(12648);
}


In the case of BeaconGameObj.cpp, its correctly subtracting 1000 (aka ID_MIN) before doing the comparison.
Checking tdbedit, it looks like Goto in tdbedit.cpp (based on the things that call it) is supposed to take an index into the TranslateDBClass array and therefore is doing what it should be doing.

So in theory if you make sure that there is a string with an ID that's at least 1000 more than the IDs you are using for your weapon strings, it SHOULD work. (hence why it works for other people)

As for an actual fix, I will commit a fix to 5.0 (where work is going forward) and to 4.2 (our stable branch) but we wont be releasing a fix for 4.1 at this time.


Sounds good thanks, for a second I thought you were going to make me add 100 id's just to make this work lol.


Re: Vehicle WEAPON names no longer shows up [message #487439 is a reply to message #487407] Thu, 01 May 2014 01:28 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
But that still doesn't explain why you'd compare a non-sequential ID against the object count. String IDs are not, to my knowledge anyway, re-numbered when entries are deleted (or things referencing them would break if they were not also updated) so a list of IDs as follows;


1, 2, 6, 7, 10

would have a count of 5, so indexes 6, 7 and 10 would become inaccessible because they are > 5 (ignoring the MIN_ID bit for now). It still looks like a flaw to me...


http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Thu, 01 May 2014 01:28]

Report message to a moderator

Re: Vehicle WEAPON names no longer shows up [message #487441 is a reply to message #487407] Thu, 01 May 2014 03:20 Go to previous messageGo to next message
jonwil is currently offline  jonwil
Messages: 3555
Registered: February 2003
Karma: 0
General (3 Stars)

Here is TranslateDBClass::Add_Object from TranslateDBClass.cpp:
bool TranslateDBClass::Add_Object(TDBObjClass *object)
{
	if (object)
	{
		if (object->Get_ID() <= 999)
		{
			object->Set_ID(Find_Unique_ID());
		}
		int id = object->Get_ID() - 1000;
		while (m_ObjectList.Count() <= id)
		{
			TDBObjClass *obj = 0;
			m_ObjectList.Add(obj);
		}
		m_ObjectList[id] = object;
		StringClass str = object->Get_ID_Desc();
		_strlwr(str.Peek_Buffer());
		m_ObjectHash.Insert(str,object);
		return true;
	}
	return false;
}

If you look at it, you can see clearly that it specifically adds empty strings such that the index into the array is always equal to the ID - 1000 (the while() loop in the code above)
In your example, element 0 in the array would contain string ID 1, element 1 would contain string ID 2, element 3 would be empty, element 4 would be empty, element 5 would contain string ID 6, element 6 would contain string ID 7, element 7 would be empty, element 8 would be empty and element 9 would contain string ID 10. Count would be 10.


Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies

[Updated on: Thu, 01 May 2014 03:23]

Report message to a moderator

Re: Vehicle WEAPON names no longer shows up [message #487442 is a reply to message #487407] Thu, 01 May 2014 04:18 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
OK, so we just end up with an array with empty gaps where deleted strings used to live? Kind of crappy from a memory usage perspective but it does explain why comparing against object count would be OK.

http://steamsignature.com/card/1/76561197975867233.png
Re: Vehicle WEAPON names no longer shows up [message #487445 is a reply to message #487442] Thu, 01 May 2014 06:57 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3805
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
Okay so I guess we don't know why it isn't working?

I attached my string_ids header file and strings_map.tbl if that helps.


Re: Vehicle WEAPON names no longer shows up [message #487446 is a reply to message #487407] Thu, 01 May 2014 07:06 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
No, we do know why it isn't working, as jonwil explained above. The top 999 allocated IDs are un-usuable for vehicle weapon names currently, as indicated above. It will be patched for 5.0 and in the 4.2 branch.

Checking against the object count IS valid due to how it populates gaps in the table but there is a different bug whereby it should have subtracted 1000 from the ID first before comparing it to the count.


http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Thu, 01 May 2014 07:08]

Report message to a moderator

Re: Vehicle WEAPON names no longer shows up [message #487447 is a reply to message #487446] Thu, 01 May 2014 07:30 Go to previous message
Jerad2142 is currently offline  Jerad2142
Messages: 3805
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
jonwil wrote on Wed, 30 April 2014 15:58



const wchar_t *VehicleGameObj::Get_Vehicle_Name()
{
	if (( Get_Definition().VehicleNameID != 0 ) && (Get_Definition().VehicleNameID-1000 < TranslateDBClass::Get_Object_Count())) {
		return TranslateDBClass::Get_String( Get_Definition().VehicleNameID );
	}
	return TRANSLATE(12648);
}




I went ahead and tried that but of course it didn't work, I assume that its called via client side code instead of scripts code so my change doesn't actually persist to the .dll it needs to.


[Updated on: Thu, 01 May 2014 07:53]

Report message to a moderator

Previous Topic: Feature request, clients update objectives
Next Topic: tdbedit.exe fails to list the strings I have under the default tab in my strings file.
Goto Forum:
  


Current Time: Sat Apr 13 08:34:48 MST 2024

Total time taken to generate the page: 0.01869 seconds