#### Archived

This topic is now archived and is closed to further replies.

# Quake 3 BSP

This topic is 6333 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

This question is mostly for someone who has written a Q3 bsp viewer since it probably requires some knowledge of the file format, but anyone who thinks they can help is of course welcome to answer... I thought this code should print the bounding box of the leaf that point[3] is in, but it doesn''t seem to work.
int currentNode = 0;

while(TRUE)
{
float point[3] = {0,0,0};

float plane[4];

plane[0] = lanes[nodes[currentNode].plane].normal[0];
plane[1] = lanes[nodes[currentNode].plane].normal[1];
plane[2] = lanes[nodes[currentNode].plane].normal[2];
plane[3] = planes[nodes[currentNode].plane].dist;

if(point[0] * plane[0] + point[1] * plane[1] + point[2] * plane[2] >= plane[3])
currentNode = nodes[currentNode].children[0];
else
currentNode = nodes[currentNode].children[1];

if(currentNode < 0)
{
FILE *debug = fopen("debug.txt", "w");
fprintf(debug, "%d %d %d\n", leaves[-currentNode].mins[0], leaves[-currentNode].mins[1], leaves[-currentNode].mins[2]);
fprintf(debug, "%d %d %d", leaves[-currentNode].maxs[0], leaves[-currentNode].maxs[1], leaves[-currentNode].maxs[2]);
fclose(debug);

break;
}

I''d really appriciate if anyone took the time to read through this code, and see if they find anything strange... (This may be completely out of line, since this is the first time I''m working with bsp''s). Thanks

##### Share on other sites
Don''t mind this, I solved it. It should be -(currentNode+1) instead of only -currentNode. And that took several hours figuring out...

1. 1
Rutin
42
2. 2
3. 3
4. 4
5. 5

• 9
• 27
• 20
• 14
• 14
• ### Forum Statistics

• Total Topics
633385
• Total Posts
3011605
• ### Who's Online (See full list)

There are no registered users currently online

×