Help! What are these numbers?
Moderator: InsideQC Admins
5 posts
• Page 1 of 1
Help! What are these numbers?
model.c(655): out = Hunk_AllocName ( (count+8)*sizeof(*out), loadname); // Manoel Kasimier - skyboxes - extra for skybox // Code taken from the ToChriS engine - Author: Vic (vic@quakesrc.org) (http://hkitchen.quakesrc.org/)
model.c(720): out = Hunk_AllocName ( (count + 13) * sizeof(*out), loadname); // Manoel Kasimier - skyboxes - extra for skybox // Code taken from the ToChriS engine - Author: Vic (vic@quakesrc.org) (http://hkitchen.quakesrc.org/)
model.c(750): out = Hunk_AllocName ( (count+6)*sizeof(*out), loadname); // Manoel Kasimier - skyboxes - extra for skybox // Code taken from the ToChriS engine - Author: Vic (vic@quakesrc.org) (http://hkitchen.quakesrc.org/)
model.c(869): out = Hunk_AllocName ( (count+6)*sizeof(*out), loadname); // Manoel Kasimier - skyboxes - extra for skybox // Code taken from the ToChriS engine - Author: Vic (vic@quakesrc.org) (http://hkitchen.quakesrc.org/)
model.c(1209): out = Hunk_AllocName ( (count+24)*sizeof(*out), loadname); // Manoel Kasimier - skyboxes - extra for skybox // Code taken from the ToChriS engine - Author: Vic (vic@quakesrc.org) (http://hkitchen.quakesrc.org/)
model.c(1236): out = Hunk_AllocName ( (count+6)*sizeof(*out), loadname); // Manoel Kasimier - skyboxes - extra for skybox // Code taken from the ToChriS engine - Author: Vic (vic@quakesrc.org) (http://hkitchen.quakesrc.org/)
I'm going to play with using Sajt's palettization code to see if I can get "WinQuake" to load a 24-bit TGA skybox and reduce it to the current 256-color palette (I would say "Quake palette" but mods can use their own palette so that isn't quite technically true.)
Stage 1 is of course is to simply load a PCX skybox.
But what are these extra +6, +24 and stuff.
HunkAlloc plus code like this ...
- Code: Select all
for ( i=0 ; i<count ; i++, in++, out++)
{
bits = 0;
for (j=0 ; j<3 ; j++)
{
out->normal[j] = LittleFloat (in->normal[j]);
if (out->normal[j] < 0)
bits |= 1<<j;
}
out->dist = LittleFloat (in->dist);
out->type = LittleLong (in->type);
out->signbits = bits;
}
... freaks me out if the Hunk_Alloc isn't the right size for obvious reasons.
This one in particular bothers me in Mod_LoadPlanes ...
// out = Hunk_AllocName ( count*2*sizeof(*out), loadname);
out = Hunk_AllocName ( (count+6)*sizeof(*out), loadname); // Manoel Kasimier - skyboxes - extra for skybox // Code taken from the ToChriS engine - Author: Vic (vic@quakesrc.org) (http://hkitchen.quakesrc.org/)
Where the "*2" mysteriously has disappeared.
I may answer my own question and reply to my own post ... but I don't want to risk forgetting this question.
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
6 faces, 4 vertexes per face (6 x 4 = 24), 8 vertexes total, not sure about the "13", definitely loading extra stuff for hacking in more BSP content later on. It would be interesting to compare with the Q2 software renderer. The * 2 disappearing from Mod_LoadPlanes freaks me too, but then again it also freaks me that it's there in the first place!
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
The 13 is 1+12 edges, since the original code also adds an extra edge.
I'm not sure why the need for an extra edge, but the renderer does add a dummy surface upon loading, and uses it to set the unused areas of the display buffer to r_clearcolor upon drawing the world's scanlines.
I'm also not sure about the *2 in Mod_LoadPlanes, but its usage in the original code does seem weird. I'm putting it back now, just in case:
Thanks Baker.
I'm not sure why the need for an extra edge, but the renderer does add a dummy surface upon loading, and uses it to set the unused areas of the display buffer to r_clearcolor upon drawing the world's scanlines.
I'm also not sure about the *2 in Mod_LoadPlanes, but its usage in the original code does seem weird. I'm putting it back now, just in case:
- Code: Select all
out = Hunk_AllocName ( (count+6)*2*sizeof(*out), loadname); // Manoel Kasimier - skyboxes - extra for skybox // Code taken from the ToChriS engine - Author: Vic (vic@quakesrc.org) (http://hkitchen.quakesrc.org/)
Thanks Baker.
-

mankrip - Posts: 915
- Joined: Fri Jul 04, 2008 3:02 am
mk wrote:I'm also not sure about the *2 in Mod_LoadPlanes, but its usage in the original code does seem weird. I'm putting it back now, just in case
If you're putting it back, I'm sure as hell gonna put it back too
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
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest