Problem with DLIGHTS > 32
Moderator: InsideQC Admins
7 posts
• Page 1 of 1
Problem with DLIGHTS > 32
I've looked at both Qrack and the RMQ engine to try to bump up MAX_DLIGHTS properly above 32, using 128.
1. I expanded dlightbits from int to 4 ints. (32 bytes x 4 = 128 bits) in gl_model.h
2. R_Marklights clears all 4 ints and sets the appropriate bit if affected by dynamic lighting.
3. R_AddDynamicLights checks the appropriate bit in the group of 4 ints
msurface_t is the in memory representation of a surface. As far as I know, I should be able to add 12 bytes (3 more ints) and for the most part handle it how I want.
Any thoughts? I'm thinking my problem is related to a memory corruption and looking at gl_model.c to see how msurface_t is getting allocated and seeing how the data is filled in ...
1. I expanded dlightbits from int to 4 ints. (32 bytes x 4 = 128 bits) in gl_model.h
- Code: Select all
NEW: int dlightbits[(MAX_DLIGHTS + 31) >> 5]; // mh - 128 dynamic lights
OLD: int dlightbits;
2. R_Marklights clears all 4 ints and sets the appropriate bit if affected by dynamic lighting.
- Code: Select all
if (surf->dlightframe != r_dlightframecount) // not dynamic until now
{
surf->dlightbits[0] = surf->dlightbits[1] = surf->dlightbits[2] = surf->dlightbits[3] = 0;
// memset (surf->dlightbits, 0, sizeof (surf->dlightbits));
surf->dlightframe = r_dlightframecount;
}
// mark the surf and ent for this dlight
surf->dlightbits[num >> 5] |= 1 << (num & 31);
3. R_AddDynamicLights checks the appropriate bit in the group of 4 ints
- Code: Select all
if ( !(surf->dlightbits[lnum >> 5] & (1 << (lnum & 31)))) //MH
msurface_t is the in memory representation of a surface. As far as I know, I should be able to add 12 bytes (3 more ints) and for the most part handle it how I want.
Any thoughts? I'm thinking my problem is related to a memory corruption and looking at gl_model.c to see how msurface_t is getting allocated and seeing how the data is filled in ...
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
Re: Problem with DLIGHTS > 32
Nevermind!
Wasn't aware there was a tutorial on this.
viewtopic.php?f=12&t=4257
(Sheesh ... I had omitted something stupid. No wonder it crashed .... Grrrr. Dumb mistake. Then again I wasn't using the tutorial, but still ...)
Wasn't aware there was a tutorial on this.
viewtopic.php?f=12&t=4257
(Sheesh ... I had omitted something stupid. No wonder it crashed .... Grrrr. Dumb mistake. Then again I wasn't using the tutorial, but still ...)
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
Re: Problem with DLIGHTS > 32
Ah, but because you tried to implement it on your own, you truly understood the tutorial. And because you understood the tutorial, you know what you did wrong. Maybe next time you'll be able to avoid the same mistake
.
I'll have to take a look at the tut
I'll have to take a look at the tut
Leave others their otherness.
http://quakeforge.net/
http://quakeforge.net/
- taniwha
- Posts: 399
- Joined: Thu Jan 14, 2010 7:11 am
Re: Problem with DLIGHTS > 32
In 1.9 I blindly increased dlights without any backbone to it
Same for lightmaps I need to nix half life map support it's kinda useless and breaks demos
Except in DirectQ and dark places
Same for lightmaps I need to nix half life map support it's kinda useless and breaks demos
Except in DirectQ and dark places
- r00k
- Posts: 1110
- Joined: Sat Nov 13, 2004 10:39 pm
Re: Problem with DLIGHTS > 32
regarding extended lightstyles and demo/protocol incompatibility, just don't send/write those lightstyles if they're empty, and make sure they're properly cleared on map changes.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
Re: Problem with DLIGHTS > 32
I can appreciate that, i opened a book trying to make something of a better client than proquake in 2003 based on joequake. I was focusing on the QRP engine then saw QMB particles, and the flow of quakesource.com additions, and jq encompassed most. and i jumped on that codebase. I am more a quakeC coder and a player. So im kinda biased. I get first hand bitching from the player base. Mostly. mods are focal and player dont care about useability of a feature if its not focused on their game (mod).. i just get caught up with mr jones when no one knows him...
- r00k
- Posts: 1110
- Joined: Sat Nov 13, 2004 10:39 pm
Re: Problem with DLIGHTS > 32
Definitely agreed that it's great that you tried to implement it yourself. I learned so much from taking the same approach back when I started out (including when to say "OK, time to stop trying myself and copy what someone else has done!"
). Sure I made some horrible mistakes at the time, but I've no regrets about the experience.
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
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest