+ Reply to Thread
Results 1 to 10 of 11
Thread: C++ No Fog
-
08-07-2008 07:40 AM #1Ultimate Subscriber
- Join Date
- May 2008
- Location
- Bathurst, NSW, Australia
- Posts
- 147
C++ No Fog
Firstly add your bool
ThenCode:bool bNoFog = false;
Add this to your Post Render
In example bot for instanceCode: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; } }
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)) } } }
-
08-07-2008 02:40 PM #2America'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...
then call your function like this:Code:void RemoveFog () { for (TObjectIterator<AZoneInfo> Target; Target; ++Target) { AZoneInfo* ZI = *Target; ZI->bClearToFogColor = false; ZI->bDistanceFog = false; } }
Code:RemoveFog();
To look meant Danger....To smile meant Death
-
08-07-2008 04:05 PM #3
Even simpler:
Code:if ( pPlayerController->Region.Zone ) pPlayerController->Region.Zone->bDistanceFog = !bFogHack;
-
08-07-2008 04:34 PM #4Ultimate 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
-
08-08-2008 01:06 PM #5America's Army Subscriber
- Join Date
- Jun 2008
- Posts
- 141
-
05-27-2009 12:33 AM #6Junior Member
- Join Date
- May 2009
- Posts
- 16
-
05-27-2009 03:33 AM #7Senior Member
- Join Date
- May 2008
- Posts
- 248
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
-
05-31-2009 06:44 PM #8Junior 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
-
05-31-2009 07:59 PM #9Senior 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
-
05-31-2009 08:33 PM #10Junior Member
- Join Date
- May 2009
- Posts
- 16
what are public/ private/ protected functions?


LinkBack URL
About LinkBacks



Reply With Quote

