![]() |
![]() |



Author: firefox
Date Submitted: 2004-01-06 00:31:19
/*
==========================
world_ReadVis
Parse the visibility information in a segment
==========================
*/
void world_ReadVis(int segment)
{
tchar_t* tok;
int i;
// Read Visibility string in the format 0100101, a digit for each segment, 1=visible, 0=invisible
tok = NextTok();
// ignore strings with wrong length
if( (int)com_strlen( tok ) == segment_count )
{
for( i=0; i < segment_count; i++ )
{
if( tok[i] == _T( '0' ) )
segments[segment].vis[i] = 0;
else
segments[segment].vis[i] = 1;
}
}
}Cipher offers a great functionality with its segmentation of levels. By using the defaults of the engine, one can automatically let cipher determine which of the segments is visible from each other by simply setting the "seg_visrange" CVAR before loading a level.
The Cipher docs also mention a possibility to manually state which one of the segments is visible from each other; unfortunately I wasn't able to find the according source code. At least as far as I could find it, the function responsible for reading the manual visibility information, world_ReadVis in file r_world.c of project renderer, is present but not implemented.
So all I had to do was implement it ;-). It is already called from the segment parser script, so to use it, simply copy this code to r_world.c, roughly at line 550 you will find world_ReadVis.
As the comment roughly states, you can insert visibility information into each segment by defining a digit for each segment existing, 0 for invisible, 1 for visible. By default, at least the current segment should be visible. For example:
segment_count 23
...
segment 12
{
vis 00000001111111110000001
...
[Recent Contributions] [Recent Source Code]