collision: add additional checks

This commit is contained in:
Denis Pauk 2023-12-30 16:31:47 +02:00
parent 59d6766e90
commit 6701ad8cc5
1 changed files with 11 additions and 1 deletions

View File

@ -2231,6 +2231,11 @@ CM_LeafContents(int leafnum)
int
CM_LeafCluster(int leafnum)
{
if (!cmod->map_leafs)
{
return 0;
}
if ((leafnum < 0) || (leafnum >= (cmod->numleafs + EXTRA_LUMP_LEAFS)))
{
Com_Error(ERR_DROP, "%s: bad number", __func__);
@ -2242,6 +2247,11 @@ CM_LeafCluster(int leafnum)
int
CM_LeafArea(int leafnum)
{
if (!cmod->map_leafs)
{
return 0;
}
if ((leafnum < 0) || (leafnum >= (cmod->numleafs + EXTRA_LUMP_LEAFS)))
{
Com_Error(ERR_DROP, "%s: bad number", __func__);
@ -2333,7 +2343,7 @@ CM_ClusterPVS(int cluster)
byte *
CM_ClusterPHS(int cluster)
{
if (cluster == -1)
if (cluster == -1 || !cmod->map_vis)
{
memset(phsrow, 0, (cmod->numclusters + 7) >> 3);
}