diff --git a/include/light/light.h b/include/light/light.h index 002f5f17..b7a39ad5 100644 --- a/include/light/light.h +++ b/include/light/light.h @@ -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); diff --git a/light/ltface.c b/light/ltface.c index 56454197..4fa773bd 100644 --- a/light/ltface.c +++ b/light/ltface.c @@ -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