Thumbs upProper Visible Checks

Posts 17 of 7 · Page 1 of 1
Proper Visible Checks
Hi guys

well, since i dont play this game anymore, here is my visible check function.

Code:
BOOL IsVisible(APawn *Target, FVector *start, FVector *end, BOOL *bOutIsLeaning)
{    
    BOOL bFence = FALSE;
    BOOL bNullObject = FALSE;
    BOOL bLeaning = FALSE;
    APawn *RetPawn;

    if(g_pPC != NULL && Target != NULL && start != NULL && end != NULL)
    {
        RetPawn    = (APawn *)g_pPC->Trace(*end, *start, 1, vExtent, 0, &HitLocation1, &HitNormal, &HitInfo1);

        if(HitInfo1.Material != NULL)
        {
            if(strstr(HitInfo1.Material->GetFullName(), "Fence"))
            {
                RetPawn    = (APawn *)Target->Trace(*start, *end, 1, vExtent, 0, &HitLocation2, &HitNormal, &HitInfo2);

                if(HitInfo2.Material != NULL)
                {
                    if(strstr(HitInfo2.Material->GetFullName(), "Fence")) 
                    {
                        if(!strcmp(HitInfo2.Material->GetFullName(), HitInfo1.Material->GetFullName()))
                            bFence = TRUE;
                    }
                }
            }
        }

        if(HitInfo1.Material == NULL)
        {
            if(RetPawn != NULL && !RetPawn->IsA(AVehicle::StaticClass()))
            {
                RetPawn    = (APawn *)Target->Trace(*start, *end, 1, vExtent, 0, &HitLocation2, &HitNormal, &HitInfo2);

                if(HitInfo2.Material == NULL) 
                    bNullObject = TRUE;    
            }

            if(RetPawn != NULL)
            {
                if(Target->IsA(AcAPBPawn::StaticClass()))
                {
                    AcAPBPawn *APBPawn = (AcAPBPawn *)Target;

                    if(APBPawn->m_VehicleUseData.m_bLeaningOut)
                    {
                        *bOutIsLeaning = TRUE;
                        bLeaning = TRUE;
                    }
                }
            }
            
        }
        
        

        return (Target == RetPawn || bNullObject || bFence || bLeaning);
    }

    return 0;
}

Because as you could see by using only Trace or SingleLineCheck there were some circumstances where the target wasnt visible although you could shoot at him. It's not perfect but it worked really good. Have fun.



Credits:
LowHertz
trolling in the deep..
it's quite funny, first he says: here is my visible check function, then randomly:

Credits:
LowHertz
very thank you man

but very perfect
@Margherita
Fix kabusofs double post.


And does anybody know if this is patched yet?
Really old source codes...
How do i use a source code?
Posts 17 of 7 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?