Forum

Loading External .Ent Files

Post tutorials on how to do certain tasks within game or engine code here.

Moderator: InsideQC Admins

Postby Baker » Tue Jun 07, 2011 3:45 pm

szo wrote:I'd prefer external_ents from QIP, though, because it is the first implementation (AFAIK)


Cvar names don't really matter too much, especially for what is mostly a developer feature. It is better to prefix server features with sv_ so the scope of cvar is known and understood (and the purpose of autocompleting cvars is to help you find the name of the cvar you can't remember :D ), but it isn't like that is universally applied either.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby mh » Tue Jun 07, 2011 9:16 pm

szo wrote:
Baker wrote:(This is the solution to protect against loading wrong .lit files, isn't it).

Yes. I use the same mechanism for the lit files, too.

For Fitz and derivatives it's probably no harm to change "if (data)" to "if (data && com_filesize == l->filelen * 3 + 8)" - with both checks you can be more certain that you've got the correct LIT file.

You also need to surround that block with a Hunk_LowMark/Hunk_FreeToLowMark (which I note QS has already done).
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby szo » Tue Jun 07, 2011 9:29 pm

mh wrote:
szo wrote:
Baker wrote:(This is the solution to protect against loading wrong .lit files, isn't it).

Yes. I use the same mechanism for the lit files, too.

For Fitz and derivatives it's probably no harm to change "if (data)" to "if (data && com_filesize == l->filelen * 3 + 8)" - with both checks you can be more certain that you've got the correct LIT file.

Can that be a problem if a dev has an unlit map and threw in a lit file? (Surely an ultra low-probability stupid corner case and most probably, if not ever, won't happen in real life...)
szo
 
Posts: 132
Joined: Mon Dec 06, 2010 4:42 pm

Postby mh » Tue Jun 07, 2011 9:41 pm

szo wrote:
mh wrote:
szo wrote:
Baker wrote:(This is the solution to protect against loading wrong .lit files, isn't it).

Yes. I use the same mechanism for the lit files, too.

For Fitz and derivatives it's probably no harm to change "if (data)" to "if (data && com_filesize == l->filelen * 3 + 8)" - with both checks you can be more certain that you've got the correct LIT file.

Can that be a problem if a dev has an unlit map and threw in a lit file? (Surely an ultra low-probability stupid corner case and most probably, if not ever, won't happen in real life...)

I believe the surface offsets would all be either 0 or -1 in that case (0 I'm pretty sure, but would need to check the QBSP source).
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Previous

Return to Programming Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest