Resultados 1 a 1 de 1
  1. #1
    Developer C++ boris160's Avatar
    Data de Ingresso
    Apr 2016
    Posts
    61
    Thanks Thanks Given 
    3
    Thanks Thanks Received 
    4
    Thanked in
    2 Posts
    Mencionado
    23 Post(s)

    Interface Load Imagens

    Alguma alma conseguiu desenhar imagem na 1.05D? estou tentando por um TimeBar mais na S4 n vai nem à pau, já no S6 vai sem problema, revi os offsets várias vezes e estão certos!

    Interface.h

    Código:
    
    
    Código:
    enum ObjectID
    {
            eTIME,
    };
    
    
    struct InterfaceObject
    {
        DWORD    ModelID;
        float    Width;
        float    Height;
        float    X;
        float    Y;
        float    MaxX;
        float    MaxY;
        DWORD    EventTick;
        bool    OnClick;
        bool    OnShow;
        BYTE    Attribute;
    };
    
    
    class Interface
    {
    public:
    
    
        void        Load();
        static void    Work();
        static void    LoadImages();
        static void LoadModels();
        void        BindObject(short ObjectID, DWORD ModelID, float Width, float Height, float X, float Y);
        bool        CheckWindow(int WindowID);
        void        DrawTime();
        int        DrawFormat(DWORD Color, int PosX, int PosY, int Width, int Align, LPCSTR Text, ...);
        void        DrawGUI(short ObjectID, float PosX, float PosY);
    
    
        InterfaceObject Data[MAX_OBJECT];
    private:
        
    };
    extern Interface gInterface;



    Interfcae.cpp

    Código:
    
    
    
    void Interface::Load()
    {
           this->BindObject(eTIME, 0x787E, 131, 70, -10, 359); 
        this->Data[eTIME].OnShow = true;
        // ----
        SetOp((LPVOID)oDrawInterface_Call, this->Work, ASM::CALL);
        SetOp((LPVOID)oLoadSomeForm_Call, this->LoadImages, ASM::CALL);
        SetOp((LPVOID)0x005DBC22, this->LoadModels, ASM::CALL);
        
    }
    
    
    void Interface::Work()
    {
        gInterface.DrawTime();
        ReconnectMainProc();
        pDrawInterface();
    }
    
    
    void Interface::LoadImages()
    {
    
    
        pLoadImage("Custom\\Interface\\TimeBar.tga", 0x787E, 0x2601, 0x2901, 1, 0);
        // ----
        pLoadSomeForm();
    }
    
    
    void Interface::LoadModels()
    {
        pInitModelData2();
    }
    
    
    void Interface::BindObject(short MonsterID, DWORD ModelID, float Width, float Height, float X, float Y)
    {
        this->Data[MonsterID].EventTick    = 0;
        this->Data[MonsterID].OnClick    = false;
        this->Data[MonsterID].OnShow    = false;
        this->Data[MonsterID].ModelID    = ModelID;
        this->Data[MonsterID].Width        = Width;
        this->Data[MonsterID].Height    = Height;
        this->Data[MonsterID].X            = X;
        this->Data[MonsterID].Y            = Y;
        this->Data[MonsterID].MaxX        = X + Width;
        this->Data[MonsterID].MaxY        = Y + Height;
        this->Data[MonsterID].Attribute    = 0;
    }
    
    
    bool Interface::CheckWindow(int WindowID)
    {
        return pCheckWindow(pWindowThis(), WindowID);
    }
    
    
    void Interface::DrawTime()
    {
        if( !this->Data[eTIME].OnShow )
        {
            return;
        }
        // ----
        /*if( this->CheckWindow(ObjWindow::ChatWindow) || this->CheckWindow(ObjWindow::CashShop)
        || this->CheckWindow(ObjWindow::FullMap) || this->CheckWindow(ObjWindow::SkillTree)
        || this->CheckWindow(ObjWindow::MoveList) || gObjUser.m_MapNumber == 34 || gObjUser.m_MapNumber == 30 )*/
        if(this->CheckWindow(ObjWindow::CashShop)|| this->CheckWindow(ObjWindow::FullMap) || this->CheckWindow(ObjWindow::ChatWindow) || this->CheckWindow(ObjWindow::SkillTree)
            || this->CheckWindow(ObjWindow::MoveList) || gObjUser.m_MapNumber == 34 || gObjUser.m_MapNumber == 30 )
        {
            return;
        }
        // ----
        //this->DrawGUI(eTIME, 0, -3);
    
    
    
    
          this->DrawGUI(eTIME, this->Data[eTIME].X, this->Data[eTIME].Y);
        // -----
        time_t TimeServer, TimeLocal;
        struct tm * ServerT, * LocalT;
        time(&TimeServer);
        time(&TimeLocal);
        // ----
        ServerT = gmtime(&TimeServer);
        // ----
        char ServerTimeName[25] = "Server:";
        char ServerTime[30];
    
    
        sprintf(ServerTime, "%2d:%02d:%02d", (ServerT->tm_hour)%24, ServerT->tm_min, ServerT->tm_sec);
        // -----
        LocalT = localtime(&TimeLocal); 
        // -----
        char LocalTimeName[25] = "Local:";
        char LocalTime[30];
        sprintf(LocalTime, "%2d:%02d:%02d", LocalT->tm_hour, LocalT->tm_min, LocalT->tm_sec);
        // -----
        this->DrawFormat(eGold, 5, 391, 50, 1, ServerTimeName);
        this->DrawFormat(eWhite, 55, 391, 100, 1, ServerTime);
        // ----
        this->DrawFormat(eGold, 5, 413, 50, 1, LocalTimeName);
        this->DrawFormat(eWhite, 55, 413, 100, 1, LocalTime);
    }
    
    
    int Interface::DrawFormat(DWORD Color, int PosX, int PosY, int Width, int Align, LPCSTR Text, ...)
    {
        char Buff[2048];
        int BuffLen    = sizeof(Buff)-1;
        ZeroMemory(Buff, BuffLen);
        
        va_list args;
        va_start(args, Text);
        int Len    = vsprintf_s(Buff, BuffLen, Text, args);
        va_end(args);
        
        int LineCount = 0;
        
        char * Line = strtok(Buff, "\n");
        
        while( Line != NULL )
        {
            pDrawColorText(Line, PosX, PosY, Width, 0, Color, 0, Align);
            PosY += 10;
            Line = strtok(NULL, "\n");
        }
        
        return PosY;
    }
    
    
    void Interface::DrawGUI(short ObjectID, float PosX, float PosY)
    {
        if( this->Data[ObjectID].X == -1 || this->Data[ObjectID].Y == -1 )
        {
            this->Data[ObjectID].X        = PosX;
            this->Data[ObjectID].Y        = PosY;
            this->Data[ObjectID].MaxX    = PosX + this->Data[ObjectID].Width;
            this->Data[ObjectID].MaxY    = PosY + this->Data[ObjectID].Height;
        }
    
    
        pDrawGUI(this->Data[ObjectID].ModelID, PosX, PosY,this->Data[ObjectID].Width, this->Data[ObjectID].Height);
    }



    OffSets

    Código:
    #define pDrawInterface            ((void(__cdecl*)()) 0x00719FEB)
    #define oDrawInterface_Call         0x00719F38
    #define pLoadImage                ((int(__cdecl*)(char * Folder, int Code, int Arg3, int Arg4, int Arg5, int Arg6)) 0x006A92BE) //OK
    #define pLoadSomeForm            ((void(__cdecl*)()) 0x006B55DE) //OK
    #define oLoadSomeForm_Call        0x006B5280 //OK
    #define pDrawGUI                             ((void(__cdecl*)(DWORD, float, float, float, float)) 0x006E26E3)
    #define pWindowThis                ((LPVOID(*)()) 0x750101)
    #define pCheckWindow            ((bool(__thiscall*)(LPVOID This, int Code)) 0x007499D7)
    #define pInitModelData2            ((void(__cdecl*)()) 0x005D0B05)
    Print sem o TimeBar

    Last edited by boris160; 25/08/2018 at 03:20 PM.

Tags para este Tópico

Permissões de Postagem

  • Você não pode iniciar novos tópicos
  • You may not post Resposta(s)
  • Você não pode enviar anexos
  • Você não pode editar suas mensagens
  •  
Sobre nós
Somos uma comunidade em atividade a 8 anos que aborda assuntos relacionados a games em geral, principalmente games MMORPG. e que busca sempre ajudar os membros através de conteúdos, tutoriais e suporte...
Nossos anunciantes
Hinetworks
VelozHost
InovHost
Rede Sociais