light: Mod_LeafPvs: return whether we found a real pvs
This commit is contained in:
parent
318fc23481
commit
f3132f342c
|
|
@ -303,7 +303,7 @@ Face_MakeInwardFacingEdgePlanes(const bsp2_t *bsp, const bsp2_dface_t *face, pla
|
|||
/* vis testing */
|
||||
const bsp2_dleaf_t *Light_PointInLeaf( const bsp2_t *bsp, const vec3_t point );
|
||||
int Light_PointContents( const bsp2_t *bsp, const vec3_t point );
|
||||
void Mod_LeafPvs(const bsp2_t *bsp, const bsp2_dleaf_t *leaf, byte *out);
|
||||
bool Mod_LeafPvs(const bsp2_t *bsp, const bsp2_dleaf_t *leaf, byte *out);
|
||||
int DecompressedVisSize(const bsp2_t *bsp);
|
||||
bool Pvs_LeafVisible(const bsp2_t *bsp, const byte *pvs, const bsp2_dleaf_t *leaf);
|
||||
|
||||
|
|
|
|||
|
|
@ -671,7 +671,7 @@ static void Mod_Q1BSP_DecompressVis(const unsigned char *in, const unsigned char
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
Mod_LeafPvs(const bsp2_t *bsp, const bsp2_dleaf_t *leaf, byte *out)
|
||||
{
|
||||
const int num_pvsclusterbytes = DecompressedVisSize(bsp);
|
||||
|
|
@ -684,20 +684,21 @@ Mod_LeafPvs(const bsp2_t *bsp, const bsp2_dleaf_t *leaf, byte *out)
|
|||
const int leafnum = (leaf - bsp->dleafs);
|
||||
const int visleaf = leafnum - 1;
|
||||
if (visleaf < 0 || visleaf >= bsp->dmodels[0].visleafs)
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (leaf->visofs < 0)
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (leaf->visofs >= bsp->visdatasize) {
|
||||
logprint("Mod_LeafPvs: invalid visofs for leaf %d\n", leafnum);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
Mod_Q1BSP_DecompressVis(bsp->dvisdata + leaf->visofs,
|
||||
bsp->dvisdata + bsp->visdatasize,
|
||||
out,
|
||||
out + num_pvsclusterbytes);
|
||||
return true;
|
||||
}
|
||||
|
||||
// returns true if pvs can see leaf
|
||||
|
|
|
|||
Loading…
Reference in New Issue