+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: C++ No Fog

  1. #1
    Ultimate Subscriber
    Join Date
    May 2008
    Location
    Bathurst, NSW, Australia
    Posts
    147

    C++ No Fog

    Firstly add your bool

    Code:
    bool   bNoFog	 = false;
    Then
    Add this to your Post Render

    Code:
    if (aPlayerController && aPlayerController->PlayerReplicationInfo && aPlayerController->PlayerReplicationInfo->PlayerZone)
    			{
    				AZoneInfo* ZoneInfo = aPlayerController->PlayerReplicationInfo->PlayerZone;		
    				if (bNoFog)
    				{
    					ZoneInfo->bDistanceFog = FALSE; 
    					ZoneInfo->bClearToFogColor = FALSE; 
    				}
    				else
    				{
    					ZoneInfo->bDistanceFog = TRUE; 
    					ZoneInfo->bClearToFogColor = TRUE; 
    				}
    			}
    In example bot for instance

    Code:
    void MyPostRender (UCanvas* Canvas)
    {
    	if ((Canvas != NULL) && (Canvas->Viewport != NULL) && (Canvas->Viewport->Actor != NULL) 
    	&&  (Canvas->Viewport->Actor->PlayerReplicationInfo != NULL) && (Canvas->Viewport->Actor->XLevel != NULL))
    	{
    		aPlayerController = Canvas->Viewport->Actor;
    
    		if (aPlayerController->Pawn != NULL) 
                      {
    			if (aPlayerController && aPlayerController->PlayerReplicationInfo && aPlayerController->PlayerReplicationInfo->PlayerZone)
    				AZoneInfo* ZoneInfo = aPlayerController->PlayerReplicationInfo->PlayerZone;		
    				if (bNoFog)
    				{
    					ZoneInfo->bDistanceFog = FALSE; 
    					ZoneInfo->bClearToFogColor = FALSE; 
    				}
    				else
    				{
    					ZoneInfo->bDistanceFog = TRUE; 
    					ZoneInfo->bClearToFogColor = TRUE; 
    				}
    			
    
    
    
    			if ((aPlayerController->Pawn->Health > 0) && (aPlayerController->Pawn->bIsDead != true))
    		}
    	}
    }

  2. #2
    America's Army Subscriber
    Join Date
    Jun 2008
    Posts
    141
    well the above isnt really the best way to do this.. All due respect to temp2 but i find this alot more simple and keeps postrender real clean

    maybe try something like this...

    Code:
    void RemoveFog ()
    {
    	for (TObjectIterator<AZoneInfo> Target; Target; ++Target)
    	{
    	       AZoneInfo* ZI = *Target;
                   ZI->bClearToFogColor = false;
                   ZI->bDistanceFog = false;
            }
    }
    then call your function like this:

    Code:
    RemoveFog();
    To look meant Danger....To smile meant Death

  3. #3
    Lead Developer
    Join Date
    Feb 2008
    Posts
    911
    Even simpler:

    Code:
    if ( pPlayerController->Region.Zone )
        pPlayerController->Region.Zone->bDistanceFog = !bFogHack;

  4. #4
    Ultimate Subscriber
    Join Date
    May 2008
    Location
    Bathurst, NSW, Australia
    Posts
    147
    your an ass you know that don't you..

    i should of made the topic

    NoFog without using a Function lol

  5. #5
    America's Army Subscriber
    Join Date
    Jun 2008
    Posts
    141
    Quote Originally Posted by Reaper View Post
    your an ass you know that don't you..

    i should of made the topic

    NoFog without using a Function lol

    i would agree that title would sum it up.!! (lmao)

    gj unreal
    To look meant Danger....To smile meant Death

  6. #6
    Junior Member
    Join Date
    May 2009
    Posts
    16
    Quote Originally Posted by Pupp View Post

    then call your function like this:

    Code:
    RemoveFog();

    Im trying to code a simple hack. I used the 2.8.4 SDK and the Basic Bot frame from UC.

    I just don't really get when it says Call your function. Can someone provide an example please.

  7. #7
    Senior Member
    Join Date
    May 2008
    Posts
    248
    Quote Originally Posted by BCMusgrove View Post
    Im trying to code a simple hack. I used the 2.8.4 SDK and the Basic Bot frame from UC.

    I just don't really get when it says Call your function. Can someone provide an example please.
    a program has a "main" function, which windows (or the OS) calls when a program is executed

    everything inside the "main" function is executed in order (unless you intenionally disrupt that order)

    however, being that there is always only ONE main function, it is often hard to keep up with all your code. for that reason some people write subroutines/macros/functions (for C++ its functions [void,etc])

    so example

    FUNCTION_TYPE void()
    {
    do stuff
    some more stuff
    more stuff
    awesome more stuff
    sweet do stuff
    }

    eventually you'll have a hard time reading all the "stuff" in that single function. Also if you want to do a semi-complicated process over and over, why re-code (or even Copy and Paste) the required lines more than once?

    for example you want to find the sqrt of a given numbers squared value, and you will be doing this often
    well you could say

    FUNCTION_TYPE void()
    {
    int mynumber;
    int result;
    mynumber = 10;
    result = sqrt(mynumber^2);
    stuff
    stuff
    stuff
    stuff
    stuff
    stuff
    mynumber = 3;
    result = sqrt(mynumber^2);
    }

    or you could say...

    int result; //this would be global not defined in main

    int returnSqrt(int somenumber)
    {
    return result = sqrt(somenumber^2);
    }

    FUNCTION_TYPE main()
    {
    int mynumber;
    mynumber=3;
    returnSqrt(mynumber);
    }

    when that code completes it sets "result" to the answer of, the square root of 3 squared. or

    sqrt(3*3)=3

    so really functions make code managemant easier, and also allow you to perform a singular operation many many many times.

    hope that helps,im not a code guru in C++, just PHP


    Regards,
    Nightmare.
    Currently deployed in support of OEF XI-XII

  8. #8
    Junior Member
    Join Date
    May 2009
    Posts
    16
    Now I got the function thing but I'm haveing troublemakeing a struct/class . I don't know what to put below it. I've researched it but can't figure it out

  9. #9
    Senior Member
    Join Date
    May 2008
    Posts
    248

    Class C_ClassName {
    public:
    //public functions here
    private:
    //private functions here
    protected:
    //protected functions here
    }

    int main()
    {
    blah = new C_ClassName;
    blah->somepublicfunction();
    }
    Currently deployed in support of OEF XI-XII

  10. #10
    Junior Member
    Join Date
    May 2009
    Posts
    16
    what are public/ private/ protected functions?


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts