By
DoraTehExploda Code:
/*
Now, we are going to do something pretty simple... We are going to add nosky, nosmoke, noflash, and noscope this time..
So, lets add these bools at the top of our project...
bool bSky = false;
bool bSmoke = false;
bool bFlash = false;
bool bDrawingScope = false;
bool sky = false;
bool smoke = false;
bool flash = false;
bool scope = false;
static GLint vp[4];
*/
/*
Now, lets head down to glBegin and add the code...
*/
//Simply add these like you did the rest of the code you have done up to now...
//Smoke Removal
if(smoke == true)
{
GLfloat smokecol[4];
(*glGetFloatv)(GL_CURRENT_COLOR, smokecol);
if((smokecol[0]==smokecol[1]) && (smokecol[0]==smokecol[2]) && (smokecol[0]!=0.0) && (smokecol[0]!=1.0))
{
bSmoke=true;
}
else
{
bSmoke=false;
}
}
//Sky Removal
if (mode == GL_QUADS && nosky)
bSky = true;
else
bSky = false;
//Flash Removal
if(flash)
{
GLfloat flashcol[4];
(*orig_glGetFloatv)(GL_CURRENT_COLOR, flashcol);
if(flashcol[0]==1.0 && flashcol[1]==1.0 && flashcol[2]==1.0)
bFlash=true;
else
bFlash=false;
}
//Scope Removal
if(scope)
{
GLfloat curcol[4];
(*orig_glGetFloatv)(GL_CURRENT_COLOR, curcol);
if ( (curcol[0]==curcol[1] && curcol[0]==curcol[2]) && (curcol[0]==0.0 || curcol[0]==1.0)&& curcol[3]==1.0)
bDrawingScope = true;
else
bDrawingScope = false;
if (bDrawingScope) glColor4f(curcol[0],curcol[1],curcol[2],0.0f);
}
/*
Well, that is just the beginning of it, now we have to head down to glVertex3fv and hook some other functions to get the
sky and smoke removal to work correctly...
*/
//Smoke Removal
if(bSmoke==true && smoke == true)
{
return;
}
//Sky Removal
if(bSky)
{
return;
}
/*
Head on down to glVertex2f and also add this for noflash..
*/
if(bFlash)
{
if (y==vp[3])
{
GLfloat fcurcol[4];
glGetFloatv(GL_CURRENT_COLOR, fcurcol);
glColor4f(fcurcol[0],fcurcol[1],fcurcol[2],0.01f);
bFlash=false;
}
}
/*
Head on down to glViewport and add this also..
*/
glGetIntegerv(GL_VIEWPORT,vp);
/*
Now, head down to glClear, and above the mask code we did earlier, add this..
*/
glClearColor ( 0, 0, 0, 0 );
/*
Well, that sums up my 3rd tutorial. Tomorrow I will write a few more and hopefully have a good number of you actually
working on your own basehook's and adding your own stuff. Hope everyone enjoyed this..
DoraTehExploda
*/
This is the third tutorial.. I hope everyone thus far has understood everything thats been going on... As I start to learn more about what each function does and what not, I will be sure to comment more on the functions and everything to describe what they do.. It's 5 a.m. and I am exhausted.. So, today, when I wake up of course, there will be plenty more tutorials to come.. Until then, later and take it easy....
Credits -> Kalvin for helping me setup alot of this in the correct places and modifying some of the tutorial..
Panzer -> pGLBaseHook2 for the removal code.
Garrett