FWGS / xash3d-fwgs

Xash3D FWGS engine.
1.52k stars 226 forks source link

Underwater fog doesnt work after update to 4529 #439

Open adslbarxatov opened 3 years ago

adslbarxatov commented 3 years ago

Found: underwater fog doesn't work after update from build 3737 to 4529

eshq19_0000

adslbarxatov commented 3 years ago

Solved:

In cl_pmove.c, in CL_WaterEntity(): array of entities replacement:

    //for (i = 0; i < clgame.pmove->nummoveent; i++) // 3737
    //for (i = 0; i < clgame.pmove->numphysent; i++) // 4529
    for (i = 0; i < clgame.pmove->numvisent; i++)
        {
        //pe = &clgame.pmove->moveents[i];
        //pe = &clgame.pmove->physents[i];
        pe = &clgame.pmove->visents[i];

In gl_rmain.c, in R_CheckFog(): removing new texture processing:

1:

    RI.cached_waterlevel = cl.local.waterlevel;

    /*if (!IsLiquidContents (RI.cached_contents) && IsLiquidContents (cnt))
        {*/
        tex = NULL;

2:

            }
        /*else
            {
            tex = R_RecursiveFindWaterTexture (RI.viewleaf->parent, NULL, false);
            if (tex) RI.cached_contents = RI.viewleaf->contents;
            }*/

        if (!tex) return;   // no valid fogs

3:

        RI.fogSkybox = true;
        /*}

    else
        {
        RI.fogCustom = false;
        RI.fogEnabled = true;
        RI.fogSkybox = true;
        }*/
    } // end of function

Result:

eshq19_0001

P.S. If this solution is incorrent, please, remind us

a1batross commented 3 years ago

@adslbarxatov if you found a solution, you can open a PR, but check out our contribution guidelines first.

We're not Xash3D support line but we're working on separate fork, that's still active and has various bugfixes than original probably doesn't yet. If you're making your own mod, I can recommend you switching to our fork instead.

adslbarxatov commented 3 years ago

Thank you for answer! We're looking for further engine update. But it can take some time (we have only two hands for now :) ). So, we'll try your anvide in the future. We haven't analyzed the last version of this fork for existence of both bugs. So, we'll not create a request for now. But we want to fill the knowledge base with this solution. Who knows, maybe it will be helpful for somebody