LIT file fix
Moderator: InsideQC Admins
4 posts
• Page 1 of 1
LIT file fix
You know the story: you're playing a mod, the mod has a start.bsp, you have a start.lit in your ID1 folder, you get the wrong lighting.
I fixed this ages ago in DirectQ so I was quite surprised to recently learn that something similar wasn't universal.
I can't give exact code because everyone codes LIT file support differently, but the general approach is:
I fixed this ages ago in DirectQ so I was quite surprised to recently learn that something similar wasn't universal.
I can't give exact code because everyone codes LIT file support differently, but the general approach is:
- Run COM_FOpenFile to open your LIT file (let's assume it opens OK for now); the return value is the length of the file.
- Subtract 8 from the length (for the header).
- Divide the result by 3 (because it's 3 component lighting) - it should divide evenly by 3, if it doesn't it's another way of validating the LIT file.
- The final result should be equal to l->filelen, if it's not then you have the wrong LIT file and abort loading it.
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
We knew the words, we knew the score, we knew what we were fighting for
-

mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
Something to do with Q1BSP not supporting it I think.
Extending Q1BSP to support it was tried before and didn't work. LIT files were preferred at the time because they were optional (you didn't need an engine that supported them) and they didn't pollute the original BSP.
Maybe things have changed since then? If so there's a thread to shout about it on.
Extending Q1BSP to support it was tried before and didn't work. LIT files were preferred at the time because they were optional (you didn't need an engine that supported them) and they didn't pollute the original BSP.
Maybe things have changed since then? If so there's a thread to shout about it on.
Last edited by mh on Mon Jan 11, 2010 1:09 am, edited 1 time in total.
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
We knew the words, we knew the score, we knew what we were fighting for
-

mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
4 posts
• Page 1 of 1
Return to Programming Tutorials
Who is online
Users browsing this forum: No registered users and 1 guest
