efeito nevoeiro nos mapas para main Emu S4!

Fog.h

Código:
#pragma once
// ----------------------------------------------------------------------------------------------


// ----------------------------------------------------------------------------------------------
struct RGBCOLOROBJ
{
    float red;
    float green;
    float blue;
};


// ----------------------------------------------------------------------------------------------


class Fog
{
public:
                Fog();
                ~Fog();
    // ----
    void        Init();
    void        ReadList(char * File);
    void        Load();
    float        *toRGB(float *rgba);
    RGBCOLOROBJ    gColor[255];
    bool EnableFog;
    int    m_LoadedCount;
    // ----
}; extern Fog gFog;
//extern bool EnableFog;
// ----------------------------------------------------------------------------------------------
Fog.cpp

Código:
#include "stdafx.h"
#include "Fog.h"
#include "ScriptEncode.h"
// ----------------------------------------------------------------------------------------------


Fog    gFog;


// ----------------------------------------------------------------------------------------------


Fog::Fog()
{
    //this->Init();
    for(int i=0;i<255;i++)
    {
        gColor[i].red = 0.0;
        gColor[i].green = 0.0;
        gColor[i].blue = 0.0;
    }
}
// ----------------------------------------------------------------------------------------------


Fog::~Fog()
{
    // ----
}
// ----------------------------------------------------------------------------------------------


void Fog::Init()
{
    this->EnableFog = true;
    for(int i=0;i<255;i++)
    {
        gColor[i].red = 0.0;
        gColor[i].green = 0.0;
        gColor[i].blue = 0.0;
    }
}


void Fog::Load()
{
    SMDFile = fopen("Data\\Custom\\Fog.ini", "r");


    if ( SMDFile == NULL )
    {
        MessageBoxA(0,"Data\\Custom\\Fog.ini","CRITICAL ERROR",0);
        ExitProcess(1);
        return;
    }
    this->Init();
    int Token;
    int type = -1;
    int Map;
    int Red;
    int Green;
    int Blue;


    this->m_LoadedCount = 0;


    while ( true )
    {
        Token = GetToken();


        if( Token == 2)
        {
            break;
        }


        type = (int)TokenNumber;


        while ( true )
        {
            if ( type < 0 || type > 4 )
            {
                break;
            }


            Token = GetToken();


            if ( strcmp("end", TokenString ) == 0)
            {
                break;
            }


            Map        = TokenNumber;
            Token    = GetToken();
            Red        = TokenNumber;
            Token    = GetToken();
            Green    = TokenNumber;
            Token    = GetToken();
            Blue    = TokenNumber;


            this->gColor[Map].red = (float)Red;
            this->gColor[Map].green = (float)Green;
            this->gColor[Map].blue = (float)Blue;
            // ----


            this->m_LoadedCount++;
        }
    }


    fclose(SMDFile);


}


float *Fog::toRGB(float *rgba)
{
    rgba[0] /= 255.0;
    rgba[1] /= 255.0;
    rgba[2] /= 255.0;


    return rgba;
}
Other.h

Código:
#pragma once
#include "stdafx.h"
#include "Object.h"
// ----------------------------------------------------------------------------------------------
#define pMapNumber                *(int*)0x084253C
#define Main_PrintGlobal 00597630H;
#define _FC                            __fastcall


#pragma pack(push, 1)
struct CommonInfo
{
    char IP[50];
    char Version[6];
    char Serial[17];
    int UseLauncher;
    int MultiWindow;
};
#pragma pack(pop)


static BYTE XOR[3] = { 0xFC, 0xCF, 0xAB };


class Other
{
public:
    void    Load();
    // ----
    void    Crack();
    void    Changer();
    void    InitOGLHook();
    void    Message(int ColorId, char* Message);
    void    CameraClip(int type);
    void    CheckLauncher();
    void    CheckMultipleWindow();


    // ----
    static int GameLoad();
    static int TestDraw();
    static int SelectChar(lpViewObj this1, int a2, int a3, int a4);
    static void _FC MoveListInit(LPVOID This, LPVOID EDX, int Arg1, int Arg2);


    //void Other::Test();
    // ----
    void    LoadCustom();
    static void    Work();
    static void    cpu();
    char Adress[18];
    CommonInfo* m_Info;
    // ----
}; extern Other gOther;
extern int Server;
// ----------------------------------------------------------------------------------------------
Other.cpp

Código:
#include "stdafx.h"
#include "Other.h"
#include "TMemory.h"
#include "Import.h"
#include "ScriptEncode.h"
#include "Fog.h"
#include "Defines.h"
#include "Util.h"
// ----------------------------------------------------------------------------------------------


Other    gOther;
// ----------------------------------------------------------------------------------------------
bool Fog2 = false;
bool Fog = GetPrivateProfileIntA("Configuração", "Nevoa", 0, ".\\Config.ini");
int InGameEffects        = GetPrivateProfileIntA("Configuração","FixGraphics",0,".\\Config.ini");
int Anisotropy            = GetPrivateProfileIntA("Configuração","Anisotropy",0,".\\Config.ini");
int MaxAnisotropy        = GetPrivateProfileIntA("Configuração","MaxAnisotropy",0,".\\Config.ini");
int Linear                = GetPrivateProfileIntA("Configuração","Linear",0,".\\Config.ini");
// ----------------------------------------------------------------------------------------------
//OGL Function Prototypes
void (WINAPI *glEnable_original)(GLenum cap) = glEnable;
void (WINAPI *glClearColor_original)(GLclampf r,GLclampf g,GLclampf b,GLclampf a) = glClearColor;
int g_nMaxAnisotropy = MaxAnisotropy;
// ----------------------------------------------------------------------------------------------


void WINAPI glEnable_hook(GLenum mode)
{
    // ---
    if(InGameEffects != 0)
    {
        if(Anisotropy != 0)
        {
            glGetIntegerv(0x84FF,&g_nMaxAnisotropy);
            glTexParameteri(GL_TEXTURE_2D,0x84FE,g_nMaxAnisotropy-0.1);
        }
        if(Linear != 0)
        {
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
        }
    }
    else
    {
        if(Anisotropy != 0)
        {
            glGetIntegerv(0x84FF,&g_nMaxAnisotropy);
            glTexParameteri(GL_TEXTURE_2D,0x84FE,g_nMaxAnisotropy-0.1);
        }
        if(Linear != 0)
        {
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
        }
    }
    float rgba[4] = {gFog.gColor[pMapNumber].red,gFog.gColor[pMapNumber].green,gFog.gColor[pMapNumber].blue,1.0f}; gFog.toRGB(rgba);
                    
        if (mode == GL_BLEND || mode == GL_TEXTURE_2D || mode == GL_DEPTH_TEST)
            glDisable(GL_FOG);


        glFogi(GL_FOG_MODE, GL_LINEAR);
        glFogf(GL_FOG_DENSITY, 0.25f);
        glFogfv(GL_FOG_COLOR, rgba);
        if(pMapNumber==74)
        {
            glFogf(GL_FOG_START, 4050);
            glFogf(GL_FOG_END, 4850);
        }
        else
        {
            glFogf(GL_FOG_START, 1650.0f);
            glFogf(GL_FOG_END, 2100.0f);
        }
        glHint(GL_FOG_HINT, GL_NICEST);
             
        glEnable_original(GL_FOG);


        if (mode == GL_BLEND || mode == GL_TEXTURE_2D || mode == GL_DEPTH_TEST) 
            glDisable(GL_FOG);  
    if(!gFog.EnableFog)
    {
        glDisable(GL_FOG);
    }
    glEnable_original(mode);
}


void WINAPI glClearColor_hook(GLclampf r,GLclampf g,GLclampf b,GLclampf a)
{
if(gFog.EnableFog)
    {
    float rgba[4];
    rgba[0] = gFog.gColor[pMapNumber].red;
    rgba[1] = gFog.gColor[pMapNumber].green;
    rgba[2] = gFog.gColor[pMapNumber].blue;
    rgba[3] = 1.0;
    gFog.toRGB(rgba);        


    glClearColor_original(rgba[0],rgba[1],rgba[2],rgba[3]);
    }
}


void Other::InitOGLHook()
{    
    //---- glEnable
    DetourTransactionBegin();
    DetourUpdateThread(GetCurrentThread());
    DetourAttach(&(PVOID &)glEnable_original,glEnable_hook);
    DetourTransactionCommit();


    //---- glClearColor
    DetourTransactionBegin();
    DetourUpdateThread(GetCurrentThread());
    DetourAttach(&(PVOID &)glClearColor_original,glClearColor_hook);
    DetourTransactionCommit();


}


void Other::Load()
{ 
     if (!Fog)
         return;
     if (!Fog2)


    this->InitOGLHook();
}
Main.cpp

Código:
#include "Fog.h"
#include "Other.h"

gFog.Load();


gOther.Load();
stdafx.h

Código:
#include <gl\GL.h>
#include <gl\glu.h>

#pragma comment(lib,"cg.lib")
#pragma comment(lib,"cgGL.lib")
Fog.ini

0
//MapNumber Red Green Blue
0 211 212 168
2 171 185 149
3 146 206 155
6 69 39 18
7 33 77 66
10 12 30 45
24 13 75 119
25 13 75 119
26 13 75 119
27 13 75 119
28 13 75 119
29 13 75 119
33 113 132 79
34 68 63 40
41 74 0 0
45 191 200 176
51 208 203 191
56 73 58 61
57 163 171 182
54 205 133 63
82 255 245 89
84 255 255 255
85 211 212 168
86 255 56 255
87 69 39 18
88 0 210 255
end



creditos
Xemu
boris160