WhatsApp Discord
Source WideScreen para v97 (0.97k) - Kapocha - Source Mu - Mu Server Files
 

Source WideScreen para v97 (0.97k) - Kapocha

Publicado por Dakosmu, Mar 11, 2024, 05:14 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Dakosmu

Source WideScreen para v97 (0.97k) - Kapocha

Regístrate para ver el enlace
Regístrate para ver el enlace

Hola.. Les dejo la Source WideScreen para la 0.97k

Esta Source se hizo en base a los files de @kayito para la versión 0.97k Update 21
Si ya tienen bastante modificada la Source 0.97 de kayito, se dejaron comentarios indicando que se modificó en CWideScreen.cpp, ya que fue necesario tocar varias cosas que ya tenían hechas esos files.


Link:
You require the following to view this post content:
  • You require a post count of at least 1, you need another 1 posts.
Donaciones ->[/warning] Regístrate para ver el enlace

Hasta donde vi, lo que falta posicionar es el FullMap de esos files y la ventana de Lock del Chest. Después de eso, no sé qué más le falta.

Video


Window.cpp

#include "StdAfx.h"
#include "Window.h"
#include "Camera.h"
#include "Controller.h"
#include "Font.h"
#include "PrintPlayer.h"
#include "Protect.h"
#include "resource.h"

/*WideScreen*/
#include "CWideScreen.h"
/**/

cWindow gWindow;

cWindow::cWindow()
{
this->iResolutionValues[R640x480] = std::make_pair(640, 480);
this->iResolutionValues[R800x600] = std::make_pair(800, 600);
this->iResolutionValues[R1024x768] = std::make_pair(1024, 768);
this->iResolutionValues[R1280x960] = std::make_pair(1280, 960);
this->iResolutionValues[R1280x720] = std::make_pair(1280, 720);
this->iResolutionValues[R1366x768] = std::make_pair(1360, 768);
this->iResolutionValues[R1600x900] = std::make_pair(1600, 900);
this->iResolutionValues[R1920x1080] = std::make_pair(1920, 1080);

this->iWindowValues[FULL_SCREEN] = "Full Screen";
this->iWindowValues[WINDOW_MODE] = "Window Mode";
this->iWindowValues[BORDERLESS] = "Borderless";

this->m_WindowMode = WINDOW_MODE;

m_Resolution = R1024x768;

WindowWidth = this->iResolutionValues[R1024x768].first;

WindowHeight = this->iResolutionValues[R1024x768].second;

/*WideScreen*/
g_fScreenRate_x = (float)WindowWidth / /*640.0f*/gCWideScreen.numW;
/**/

g_fScreenRate_y = (float)WindowHeight / 480.0f;
}

cWindow::~cWindow()
{
char Text[33] = { 0 };

wsprintf(Text, "%d", this->m_WindowMode);

WritePrivateProfileString("Window", "WindowMode", Text, ".\\Config.ini");

wsprintf(Text, "%d", m_Resolution);

WritePrivateProfileString("Window", "Resolution", Text, ".\\Config.ini");
}

void cWindow::WindowModeLoad(HINSTANCE hins)
{
this->Instance = hins;

this->SetWindowMode(GetPrivateProfileInt("Window", "WindowMode", WINDOW_MODE, ".\\Config.ini"));

this->SetResolution(GetPrivateProfileInt("Window", "Resolution", R1024x768, ".\\Config.ini"));

SetCompleteHook(0xE9, 0x0041ED79, 0x0041EEC6);

SetCompleteHook(0xE9, 0x0041DFF0, &this->StartWindow);

SetCompleteHook(0xE9, 0x0041F617, 0x00421B0B);
}

HWND cWindow::StartWindow(HINSTANCE hCurrentInst, int nCmdShow)
{
char* windowName = "MU ONLINE";

WNDCLASS wndClass = { 0 };

wndClass.style = CS_OWNDC | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;

wndClass.lpfnWndProc = gWindow.MyWndProc;

wndClass.cbClsExtra = 0;

wndClass.cbWndExtra = 0;

wndClass.hInstance = gWindow.Instance;

wndClass.hIcon = LoadIcon(gWindow.Instance, MAKEINTRESOURCE(IDI_ICON));

wndClass.hCursor = LoadCursor(NULL, IDC_ARROW);

wndClass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);

wndClass.lpszMenuName = NULL;

wndClass.lpszClassName = windowName;

RegisterClass(&wndClass);

HWND hWnd;

if (gWindow.m_WindowMode)
{
RECT rc = { 0, 0, WindowWidth, WindowHeight };

LONG STYLE = (gWindow.m_WindowMode == 2) // Borderless
? WS_POPUP | WS_VISIBLE
: WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_VISIBLE;

AdjustWindowRect(&rc, STYLE, NULL);

hWnd = CreateWindowEx(WS_EX_APPWINDOW | WS_EX_WINDOWEDGE, windowName, gProtect.m_MainInfo.WindowName, STYLE, (GetSystemMetrics(SM_CXSCREEN) - rc.right) / 2, (GetSystemMetrics(SM_CYSCREEN) - rc.bottom) / 2, rc.right, rc.bottom + 26, NULL, NULL, gWindow.Instance, NULL);
}
else
{
hWnd = CreateWindowEx(WS_EX_APPWINDOW, windowName, gProtect.m_MainInfo.WindowName, WS_POPUP | WS_VISIBLE, 0, 0, WindowWidth, WindowHeight, NULL, NULL, gWindow.Instance, NULL);

gWindow.ChangeDisplaySettingsFunction();
}

return hWnd;
}

void cWindow::ChangeDisplaySettingsFunction()
{
DEVMODE devMode = { 0 };

devMode.dmSize = sizeof(DEVMODE);

devMode.dmDriverExtra = 0;

devMode.dmPelsWidth = WindowWidth;

devMode.dmPelsHeight = WindowHeight;

devMode.dmBitsPerPel = 32;

devMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;

ChangeDisplaySettings(&devMode, CDS_FULLSCREEN);
}

LRESULT WINAPI cWindow::MyWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_NPROTECT_EXIT_TWO: // Fix disconnect when minimize
{
return 0;
}

case WM_SIZE: // Fix disconnect when minimize
{
return 0;
}

case WM_TIMER:
{
switch (wParam)
{
case WM_AUTOCLICKTIMER:
{
SendMessage(g_hWnd, (gController.AutoClickState) ? WM_RBUTTONUP : WM_RBUTTONDOWN, MK_RBUTTON, MAKELPARAM(MouseX, MouseY));

gController.AutoClickState ^= 1;

return 0;
}

case WINDOWMINIMIZED_TIMER:
{
return 0;
}
}

break;
}
}

return CallWindowProc(WndProc, hwnd, msg, wParam, lParam);
}

void cWindow::ChangeWindowText()
{
if (SceneFlag != 5)
{
return;
}

static char text[256];

STRUCT_DECRYPT;

sprintf_s(text, sizeof(text), "%s || Resets: %d || GrandResets: %d || Level: %d", (char*)(*(DWORD*)(CharacterAttribute)+0x00), gPrintPlayer.ViewReset, gPrintPlayer.ViewGrandReset, *(WORD*)(*(DWORD*)(CharacterAttribute)+0x0E));

STRUCT_ENCRYPT;

SetWindowText(g_hWnd, text);
}

void cWindow::SetWindowMode(int mode)
{
if (mode < FULL_SCREEN || mode > BORDERLESS)
{
mode = FULL_SCREEN;
}

this->m_WindowMode = mode;
}

void cWindow::SetResolution(int res)
{
if (res >= R640x480 && res < MAX_RESOLUTION_VALUE)
{
m_Resolution = res;

WindowWidth = this->iResolutionValues[res].first;

WindowHeight = this->iResolutionValues[res].second;

/*WideScreen*/
if (res >= R1280x720)
{
gCWideScreen.WCenter = 107.f;
gCWideScreen.numW = 853.33f;
}
else
{
gCWideScreen.WCenter = 0.f;
gCWideScreen.numW = 640.f;
}
gCWideScreen.Load();
g_fScreenRate_x = (float)WindowWidth / /*640.0f*/gCWideScreen.numW;
/**/

g_fScreenRate_y = (float)WindowHeight / 480.0f;
}
}

void cWindow::ChangeWindowState()
{
RECT rc = { 0, 0, WindowWidth, WindowHeight };

if (this->m_WindowMode)
{
ChangeDisplaySettings(NULL, 0);
}
else
{
this->ChangeDisplaySettingsFunction();
}

LONG PosX = ((GetSystemMetrics(SM_CXSCREEN)) / 2) - (WindowWidth / 2);

LONG PosY = ((GetSystemMetrics(SM_CYSCREEN)) / 2) - (WindowHeight / 2);

if (this->m_WindowMode)
{
LONG STYLE = (gWindow.m_WindowMode == 2) // Borderless
? WS_POPUP | WS_VISIBLE
: WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;

LONG EXSTYLE = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;

SetWindowLongPtr(g_hWnd, GWL_STYLE, STYLE); // Set the Window Style

SetWindowLongPtr(g_hWnd, GWL_EXSTYLE, EXSTYLE); // Set the Window Extra Style

AdjustWindowRect(&rc, STYLE, FALSE); // Adjust the rectangle inside
}
else
{
LONG STYLE = WS_POPUP | WS_VISIBLE;

LONG EXSTYLE = WS_EX_APPWINDOW;

SetWindowLongPtr(g_hWnd, GWL_STYLE, STYLE); // Set the Window Style

SetWindowLongPtr(g_hWnd, GWL_EXSTYLE, EXSTYLE); // Set the Window Extra Style

AdjustWindowRect(&rc, STYLE, FALSE); // Adjust the rectangle inside
}

SetWindowPos(g_hWnd, NULL, PosX, PosY, rc.right - rc.left, rc.bottom - rc.top, SWP_SHOWWINDOW | SWP_NOZORDER | SWP_FRAMECHANGED);

MoveWindow(g_hWnd, PosX, PosY, rc.right - rc.left, rc.bottom - rc.top, TRUE); // Change the size

gCamera.SetCurrentValue(); // Fix the 3d camera position

gFont.ReloadFont();
}

Patchs.cpp

#include "stdafx.h"
#include "Patchs.h"
#include "Protect.h"
#include "Protocol.h"

/*WideScreen*/
#include "CWideScreen.h"
/**/

CPatchs gPatchs;

CPatchs::CPatchs()
{

}

CPatchs::~CPatchs()
{

}

void CPatchs::Init()
{
SetByte(0x00558EA8, 0xA0); // Accent

SetByte(0x00406F36, 0xEB); // Crack npGameGuard::init

SetByte(0x00406F5F, 0xEB); // Crack error messagebox

SetByte(0x00406F9B, 0xEB); // Crack error messagebox

SetByte(0x0041ECB5, 0xEB); // Crack mu.exe

SetByte(0x0041ED25, 0xEB); // Crack OpenMainExe

SetByte(0x0041ED5E, 0xEB); // Crack config.ini

SetByte(0x0041EFB5, 0xEB); // Crack gg init

SetByte(0x0053D90B, 0xEB); // Crack gameguard

SetByte(0x0055961C, (gProtect.m_MainInfo.ClientVersion[0] + 1)); // Version

SetByte(0x0055961D, (gProtect.m_MainInfo.ClientVersion[2] + 2)); // Version

SetByte(0x0055961E, (gProtect.m_MainInfo.ClientVersion[3] + 3)); // Version

SetByte(0x0055961F, (gProtect.m_MainInfo.ClientVersion[5] + 4)); // Version

SetByte(0x00559620, (gProtect.m_MainInfo.ClientVersion[6] + 5)); // Version

SetWord(0x005615BC, (gProtect.m_MainInfo.IpAddressPort)); // IpAddressPort

SetDword(0x005267B2, (DWORD)gProtect.m_MainInfo.ScreenShotPath); //Screenshot

MemoryCpy(0x00558ED8, gProtect.m_MainInfo.IpAddress, sizeof(gProtect.m_MainInfo.IpAddress)); // IpAddress

MemoryCpy(0x00559624, gProtect.m_MainInfo.ClientSerial, sizeof(gProtect.m_MainInfo.ClientSerial)); // ClientSerial

MemorySet(0x004127B0, 0x90, 5); // Remove MuError.log

SetDword(0x0047FB96, 0x190); // Expand global message size before newline jump

SetByte(0x00526AE5, 0xEB); // Skip Select Server Music

SetCompleteHook(0xE9, 0x00524146, 0x00524231); // Remove Select Character Texts

SetCompleteHook(0xE9, 0x0052292E, 0x00522953); // Ignore Character Level to Create MG
SetCompleteHook(0xE9, 0x00524293, 0x005242B8); // Ignore Character Level to Create MG

SetWord(0x00444B76, 0x19EB); //-> Uniria & Dinorant Reflect

SetCompleteHook(0xE9, 0x00526A5A, &this->ReduceCPU);

CreateThread(0, 0, (LPTHREAD_START_ROUTINE)this->ReduceRam, 0, 0, 0);

// Fix move cursor NPC
SetByte(0x00430B9F, 0x90);
MemorySet(0x00430BBD, 0x90, 0x7);

// Fix move cursor TRADE
SetByte(0x004335FC, 0x90);
SetByte(0x00433621, 0x90);
MemorySet(0x00433635, 0x90, 0x6);

// Fix move cursor
SetByte(0x00492EBD, 0x90);
MemorySet(0x00492EDB, 0x90, 0x7);

// Fix Shop NPC Closing send to server
SetCompleteHook(0xE9, 0x004CBB15, &this->FixShopNpcClose);

// Fix Drop Zen
MemorySet(0x0042F2DF, 0x90, 0x7);

// Fix Trade Zen Over 50000000
SetByte(0x00515BF7, 0xEB);

SetCompleteHook(0xE8, 0x0042B33D, &this->IgnoreRandomStuck);

SetCompleteHook(0xE9, 0x00483AC5, &this->FixChasingAttackMovement);

// Decrypt BMD
SetCompleteHook(0xE9, 0x004424B4, &this->DecBMD);

// EncTerrain%d.map
SetByte(0x0050E5F9, 0xEB);
SetDword(0x0050E624, (DWORD)"Data\\%s\\EncTerrain%d.map");
// EncTerrain%d.att
SetDword(0x0050E649, (DWORD)"Data\\%s\\EncTerrain%d.att");
// EncTerrain%d.obj
SetByte(0x0050E663, 0xEB);
SetDword(0x0050E68E, (DWORD)"Data\\%s\\EncTerrain%d.obj");

// Decrypt MAP
SetCompleteHook(0xE8, 0x0050E636, &this->OpenTerrainMapping);

// Decrypt ATT
SetCompleteHook(0xE8, 0x0050E658, &this->OpenTerrainAttribute);

// Decrypt OBJ
SetCompleteHook(0xE8, 0x0050E6A0, &this->OpenObjectsEnc);

SetCompleteHook(0xE8, 0x0041ED4C, &this->ReadMainVersion);

SetCompleteHook(0xE8, 0x004BC0B3, &this->RenderNumArrow);

SetCompleteHook(0xE8, 0x004BC0C1, &this->RenderEquipedHelperLife);

SetCompleteHook(0xE8, 0x004BC0C7, &this->RenderBrokenItem);
}

__declspec(naked) void CPatchs::ReduceCPU()
{
static DWORD JmpBack = 0x00526A60;

__asm
{
Push 1;

Call Dword Ptr Ds : [0x00552128] ; // Sleep

Call Dword Ptr Ds : [0x00552198] ; // GetTickCount

Jmp[JmpBack];
}
}

void CPatchs::ReduceRam(LPVOID lpThreadParameter)
{
HANDLE v1;

HANDLE v2;

while (TRUE)
{
Sleep(5000);

v1 = GetCurrentProcess();

SetProcessWorkingSetSize(v1, 0xFFFFFFFF, 0xFFFFFFFF);

v2 = GetCurrentProcess();

SetThreadPriority(v2, -2);
}
}

__declspec(naked) void CPatchs::FixShopNpcClose()
{
static DWORD jmpBack = 0x004CBB1A;
static BYTE InterfaceID;

_asm
{
Pushad;
Mov Bl, Byte Ptr Ds : [Eax] ;
Mov InterfaceID, Bl;
}

if (InterfaceID == 0xFE) // Case Shop
{
static PBMSG_HEAD pMsg;

pMsg.set(0x31, sizeof(pMsg));

gProtocol.DataSend((BYTE*)&pMsg, pMsg.size);
}

_asm
{
Popad;
Mov Bl, [Eax + 1];
Inc Bl;
Jmp jmpBack;
}
}

void CPatchs::IgnoreRandomStuck(DWORD c, DWORD Damage)
{
if (*(WORD*)(c + 2) != 390)
{
SetPlayerShock(c, Damage);
}
}

_declspec(naked) void CPatchs::FixChasingAttackMovement()
{
static DWORD jmpBack = 0x00483ACC;
static DWORD SendMove = 0x00491C40;

_asm
{
Mov Byte Ptr[Ebp + 0x2ED], 5;
Push Ebp;
Push Ebp;
Call[SendMove];
Add Esp, 0x8;
Jmp jmpBack;
}
}

_declspec(naked) void CPatchs::DecBMD()
{
static DWORD jmpBack = 0x004424BA;
static BYTE* Data;

_asm
{
Mov Data, Ebx;
Pushad;
}

if (Data[3] == 0xC)
{
Decrypt(&Data[4], &Data[8], *((long*)(Data + 4)));
}

_asm
{
Popad;
Mov Cl, [Ebx + 3];
Lea Esi, [Ebx + 4];
Jmp jmpBack;
}
}

int CPatchs::OpenTerrainMapping(char* FileName)
{
InitTerrainMappingLayer();

FILE* fp;

if (fopen_s(&fp, FileName, "rb") != 0)
{
return -1;
}

fseek(fp, 0, SEEK_END);

int EncBytes = ftell(fp);

fseek(fp, 0, SEEK_SET);

BYTE* EncData = new BYTE[EncBytes];

fread(EncData, 1, EncBytes, fp);

fclose(fp);

BYTE* Data = new BYTE[EncBytes];

Decrypt(Data, EncData, EncBytes);

delete[] EncData;

int DataPtr = 0;

BYTE Version = Data[DataPtr];

DataPtr += 1;

int iMapNumber = Data[DataPtr];

DataPtr += 1;

memcpy(TerrainMappingLayer1, Data + DataPtr, 256 * 256);

DataPtr += 256 * 256;

memcpy(TerrainMappingLayer2, Data + DataPtr, 256 * 256);

DataPtr += 256 * 256;

for (int i = 0; i < 256 * 256; i++)
{
BYTE Alpha;

Alpha = *((BYTE*)(Data + DataPtr));

DataPtr += 1;

TerrainMappingAlpha[i] = (float)Alpha / 255.0f;
}

delete[] Data;

fclose(fp);

return iMapNumber;
}

int CPatchs::OpenTerrainAttribute(char* FileName)
{
FILE* fp;

if (fopen_s(&fp, FileName, "rb") != 0)
{
char Text[256];

sprintf_s(Text, "%s file not found.", FileName);

MessageBox(g_hWnd, Text, NULL, MB_OK);

SendMessage(g_hWnd, WM_DESTROY, 0, 0);

return  -1;
}

fseek(fp, 0, SEEK_END);

int EncBytes = ftell(fp);

fseek(fp, 0, SEEK_SET);

BYTE* EncData = new BYTE[EncBytes];

fread(EncData, EncBytes, 1, fp);

BYTE* byBuffer = new BYTE[EncBytes];

Decrypt(byBuffer, EncData, EncBytes);

delete[] EncData;

if (EncBytes != 131076 && EncBytes != 65540)
{
delete[] byBuffer;

return -1;
}

bool extAtt = (EncBytes == 131076);

PacketArgumentEncrypt(byBuffer, byBuffer, EncBytes);

BYTE Version = byBuffer[0];

int iMap = byBuffer[1];

BYTE Width = byBuffer[2];

BYTE Height = byBuffer[3];

if (extAtt == false)
{
memcpy(TerrainWall, &byBuffer[4], 256 * 256);
}
else
{
BYTE TWall[256 * 256 * sizeof(WORD)];

memcpy(TWall, &byBuffer[4], 256 * 256 * sizeof(WORD));

for (int i = 0; i < 256 * 256; ++i)
{
TerrainWall[i] = TWall[i * 2];
}
}

delete[] byBuffer;

bool Error = false;

if (Version != 0 || Width != 255 || Height != 255)
{
Error = true;
}

switch (World)
{
case MAP_LORENCIA:
{
if (TerrainWall[123 * 256 + 135] != 5)
{
Error = true;
}

break;
}

case MAP_DUNGEON:
{
if (TerrainWall[120 * 256 + 227] != 4)
{
Error = true;
}

break;
}

case MAP_DEVIAS:
{
if (TerrainWall[55 * 256 + 208] != 5)
{
Error = true;
}

break;
}

case MAP_NORIA:
{
if (TerrainWall[119 * 256 + 186] != 5)
{
Error = true;
}

break;
}

case MAP_LOST_TOWER:
{
if (TerrainWall[75 * 256 + 193] != 5)
{
Error = true;
}

break;
}
}

for (int i = 0; i < 256 * 256; i++)
{
if (TerrainWall[i] >= 128)
{
Error = true;
}
}

if (Error)
{
ExitProgram();

return -1;
}

fclose(fp);

return iMap;
}

int CPatchs::OpenObjectsEnc(char* FileName)
{
FILE* fp;

if (fopen_s(&fp, FileName, "rb") != 0)
{
char Text[256];

sprintf_s(Text, "%s file not found.", FileName);

MessageBox(g_hWnd, Text, NULL, MB_OK);

SendMessage(g_hWnd, WM_DESTROY, 0, 0);

return -1;
}

fseek(fp, 0, SEEK_END);

int EncBytes = ftell(fp);

fseek(fp, 0, SEEK_SET);

BYTE* EncData = new BYTE[EncBytes];

fread(EncData, 1, EncBytes, fp);

fclose(fp);

BYTE* Data = new BYTE[EncBytes];

Decrypt(Data, EncData, EncBytes);

delete[] EncData;

int DataPtr = 0;

BYTE Version = Data[DataPtr];

DataPtr += 1;

int iMapNumber = Data[DataPtr];

DataPtr += 1;

short Count = *((short*)(Data + DataPtr));

DataPtr += 2;

for (int i = 0; i < Count; i++)
{
float Position[3];

float Angle[3];

short Type = *((short*)(Data + DataPtr));

DataPtr += 2;

memcpy(Position, Data + DataPtr, sizeof(float) * 3);

DataPtr += sizeof(float) * 3;

memcpy(Angle, Data + DataPtr, sizeof(float) * 3);

DataPtr += sizeof(float) * 3;

float Scale = *((float*)(Data + DataPtr));

DataPtr += 4;

CreateObject(Type, Position, Angle, Scale);
}

delete[] Data;

fclose(fp);

return iMapNumber;
}

bool MyGetFileNameOfFilePath(char* lpszFile, char* lpszPath)
{
int iFind = (int)'\\';

char* lpFound = lpszPath;

char* lpOld = lpFound;

while (lpFound)
{
lpOld = lpFound;

lpFound = strchr(lpFound + 1, iFind);
}

// copy name
if (strchr(lpszPath, iFind))
{
strcpy(lpszFile, lpOld + 1);
}
else
{
strcpy(lpszFile, lpOld);
}

// get rid of options appended
bool bCheck = true;

for (char* lpTemp = lpszFile; bCheck; ++lpTemp)
{
switch (*lpTemp)
{
case '\"':
case '\\':
case '/':
case ' ':
{
*lpTemp = '\0';
}

case '\0':
{
bCheck = false;

break;
}
}
}

return true;
}

bool MyGetFileVersion(char* lpszFileName, WORD* pwVersion)
{
DWORD dwHandle;

DWORD dwLen = GetFileVersionInfoSize(lpszFileName, &dwHandle); // get size

if (dwLen <= 0)
{
return false;
}

BYTE* pbyData = new BYTE[dwLen];

if (!GetFileVersionInfo(lpszFileName, dwHandle, dwLen, pbyData)) // get actual information
{
delete[] pbyData;

return false;
}

VS_FIXEDFILEINFO* pffi;

UINT uLen;

if (!VerQueryValue(pbyData, "\\", (LPVOID*)&pffi, &uLen)) // get version value
{
delete[] pbyData;

return false;
}

pwVersion[0] = HIWORD(pffi->dwFileVersionMS);

pwVersion[1] = LOWORD(pffi->dwFileVersionMS);

pwVersion[2] = HIWORD(pffi->dwFileVersionLS);

pwVersion[3] = LOWORD(pffi->dwFileVersionLS);

delete[] pbyData;

return true;
}

BOOL CPatchs::ReadMainVersion()
{
memcpy(m_Version, "0.97.11", 11);

char* lpszCommandLine = GetCommandLine();

char lpszFile[MAX_PATH];

if (MyGetFileNameOfFilePath(lpszFile, lpszCommandLine))
{
WORD wVersion[4];

if (MyGetFileVersion(lpszFile, wVersion))
{
sprintf(m_ExeVersion, "%d.%02d", wVersion[0], wVersion[1]);

if (wVersion[2] > 0)
{
char lpszMinorVersion[3] = "a";

if (wVersion[2] > 26)
{
lpszMinorVersion[0] = 'A';

lpszMinorVersion[0] += (wVersion[2] - 27);

lpszMinorVersion[1] = '+';
}
else
{
lpszMinorVersion[0] += (wVersion[2] - 1);
}

strcat(m_ExeVersion, lpszMinorVersion);
}
}
else
{
strcpy(m_ExeVersion, m_Version);
}
}
else
{
strcpy(m_ExeVersion, m_Version);
}

return TRUE;
}

bool CPatchs::RenderNumArrow()
{
STRUCT_DECRYPT;

ITEM* PlayerRightHand = &*(ITEM*)(*(DWORD*)(CharacterMachine)+(536 + (68 * EQUIPMENT_WEAPON_RIGHT)));

ITEM* PlayerLeftHand = &*(ITEM*)(*(DWORD*)(CharacterMachine)+(536 + (68 * EQUIPMENT_WEAPON_LEFT)));

if (PlayerRightHand->Type == GET_ITEM(4, 15)) // Arrows
{
int screenWidth = GetScreenWidth();

int MaxQuant = ((int(__cdecl*)()) 0x00482850)();

char text[128] = { '\0' };

sprintf_s(text, GetTextLine(351), PlayerRightHand->Durability, MaxQuant);

SelectObject(m_hFontDC, g_hFont);

/*WideScreen*/
int PosX = screenWidth - WGetTextWidth(text) - 10;
/**/

if (PartyNumber > 0)
{
PosX -= 60;
}

EnableAlphaTest(true);

DWORD backupBgTextColor = SetBackgroundTextColor;

DWORD backupTextColor = SetTextColor;

SetBackgroundTextColor = Color4b(0, 0, 0, 128);

SetTextColor = Color4b(255, 255, 255, 255);

RenderText(PosX, 4, text, 0, RT3_SORT_LEFT, NULL);

SetBackgroundTextColor = backupBgTextColor;

SetTextColor = backupTextColor;

STRUCT_ENCRYPT;

return true;
}

if (PlayerLeftHand->Type == GET_ITEM(4, 7)) // Bolts
{
int screenWidth = GetScreenWidth();

int MaxQuant = ((int(__cdecl*)()) 0x00482850)();

char text[128] = { '\0' };

sprintf_s(text, GetTextLine(352), PlayerLeftHand->Durability, MaxQuant);

SelectObject(m_hFontDC, g_hFont);

/*WideScreen*/
int PosX = screenWidth - WGetTextWidth(text) - 6;
/**/

if (PartyNumber > 0)
{
PosX -= 60;
}

EnableAlphaTest(true);

DWORD backupBgTextColor = SetBackgroundTextColor;

DWORD backupTextColor = SetTextColor;

SetBackgroundTextColor = Color4b(0, 0, 0, 128);

SetTextColor = Color4b(255, 255, 255, 255);

RenderText(PosX, 4, text, 0, RT3_SORT_LEFT, NULL);

SetBackgroundTextColor = backupBgTextColor;

SetTextColor = backupTextColor;

STRUCT_ENCRYPT;

return true;
}

STRUCT_ENCRYPT;

return false;
}

int CPatchs::RenderEquipedHelperLife(bool RenderedArrow)
{
int PosY = 4;

if (RenderedArrow)
{
PosY += 12;
}

int screenWidth = GetScreenWidth();

DWORD backupBgTextColor = SetBackgroundTextColor;

DWORD backupTextColor = SetTextColor;

STRUCT_DECRYPT;

ITEM* PlayerHelper = &*(ITEM*)(*(DWORD*)(CharacterMachine)+(536 + (68 * EQUIPMENT_HELPER)));

if (PlayerHelper->Type >= GET_ITEM(13, 0) && PlayerHelper->Type <= GET_ITEM(13, 3))
{
ITEM_ATTRIBUTE* ItemInfo = (ITEM_ATTRIBUTE*)(ItemAttribute + PlayerHelper->Type * sizeof(ITEM_ATTRIBUTE));

char text[128] = { '\0' };

sprintf_s(text, "%s", ItemInfo->Name);

SelectObject(m_hFontDC, g_hFont);

/*WideScreen*/
int PosX = screenWidth - WGetTextWidth(text) - 6;
/**/

if (PartyNumber > 0)
{
PosX -= 60;
}

EnableAlphaTest(true);

SetBackgroundTextColor = Color4b(0, 0, 0, 128);

SetTextColor = Color4b(255, 255, 255, 255);

RenderText(PosX, PosY, text, 0, RT3_SORT_LEFT, NULL);

PosY += 12;

float fDur = PlayerHelper->Durability / 255.0f * 50.0f;

PosX = screenWidth - 60;

if (PartyNumber > 0)
{
PosX -= 60;
}

RenderBar((float)PosX, (float)PosY, 50.0f, 2.0f, fDur, false, true);

glColor3f(1.0f, 1.0f, 1.0f);

PosY += 12;
}

STRUCT_ENCRYPT;

if (SummonLife)
{
char text[128] = { '\0' };

sprintf_s(text, "%s", GetTextLine(356));

SelectObject(m_hFontDC, g_hFont);

/*WideScreen*/
int PosX = screenWidth - WGetTextWidth(text) - 6;
/**/

if (PartyNumber > 0)
{
PosX -= 60;
}

EnableAlphaTest(true);

SetBackgroundTextColor = Color4b(0, 0, 0, 128);

SetTextColor = Color4b(255, 255, 255, 255);

RenderText(PosX, PosY, text, 0, RT3_SORT_LEFT, NULL);

PosY += 12;

float fDur = SummonLife * 0.5f;

PosX = screenWidth - 60;

if (PartyNumber > 0)
{
PosX -= 60;
}

RenderBar((float)PosX, (float)PosY, 50.0f, 2.0f, fDur, false, true);

glColor3f(1.0f, 1.0f, 1.0f);

PosY += 12;
}

SetBackgroundTextColor = backupBgTextColor;

SetTextColor = backupTextColor;

return PosY;
}

void CPatchs::RenderBrokenItem(int PosY)
{
int screenWidth = GetScreenWidth();

DWORD backupBgTextColor = SetBackgroundTextColor;

DWORD backupTextColor = SetTextColor;

ITEM* PlayerItem;

ITEM_ATTRIBUTE* ItemInfo;

int PosX;

WORD MaxDur;

char text[128] = { '\0' };

STRUCT_DECRYPT;

for (int i = EQUIPMENT_WEAPON_RIGHT; i <= EQUIPMENT_RING_LEFT; i++)
{
PlayerItem = &*(ITEM*)(*(DWORD*)(CharacterMachine)+(536 + (68 * i)));

if (PlayerItem->Type == -1)
{
continue;
}

if (PlayerItem->Type == GET_ITEM(4, 7)
    || PlayerItem->Type == GET_ITEM(4, 15)
    || (PlayerItem->Type >= GET_ITEM(13, 0) && PlayerItem->Type <= GET_ITEM(13, 3)))
{
continue;
}

ItemInfo = (ITEM_ATTRIBUTE*)(ItemAttribute + PlayerItem->Type * sizeof(ITEM_ATTRIBUTE));

MaxDur = CalcMaxDurability(PlayerItem, ItemInfo, (PlayerItem->Level >> 3) & 0xF);

if (PlayerItem->Durability > (MaxDur * 0.5f))
{
continue;
}

if (PlayerItem->Durability == 0)
{
SetTextColor = Color4b(255, 255, 255, 255);

SetBackgroundTextColor = Color4b(255, 10, 10, 128);

PlayerItem->Number = 8;
}
else if (PlayerItem->Durability <= (MaxDur * 0.2f))
{
SetTextColor = Color4b(255, 10, 10, 255);

SetBackgroundTextColor = Color4b(0, 0, 0, 128);

PlayerItem->Number = 7;
}
else if (PlayerItem->Durability <= (MaxDur * 0.3f))
{
SetTextColor = Color4b(255, 156, 0, 255);

SetBackgroundTextColor = Color4b(0, 0, 0, 128);

PlayerItem->Number = 6;
}
else if (PlayerItem->Durability <= (MaxDur * 0.5f))
{
SetTextColor = Color4b(255, 228, 0, 255);

SetBackgroundTextColor = Color4b(0, 0, 0, 128);

PlayerItem->Number = 5;
}

sprintf_s(text, "%s (%d/%d)", ItemInfo->Name, PlayerItem->Durability, MaxDur);

SelectObject(m_hFontDC, g_hFont);

/*WideScreen*/
PosX = screenWidth - WGetTextWidth(text) - 6;
/**/

if (PartyNumber > 0)
{
PosX -= 60;
}

EnableAlphaTest(true);

RenderText(PosX, PosY, text, 0, RT3_SORT_LEFT, NULL);

PosY += 12;
}

STRUCT_ENCRYPT;

SetBackgroundTextColor = backupBgTextColor;

SetTextColor = backupTextColor;
}


CWideScreen.cpp

#include "stdafx.h"
#include "CWideScreen.h"
#include "Enums.h"

#include "ServerList.h"
#include "OptionsMenu.h"

/*kayito 97k*/
//Cada modificacion tiene un "/*WideScreen*/ o //WideScreen"

/*Se modifico FullMap.cpp (falta posicionar la ventana)*/
/*Se modifico GuildLogo.cpp*/
/*Se modifico Interface.cpp*/
/*Se modifico OptionsMenu.cpp ( Se anula la linea "gOptionsMenu.Init()" de Main.cpp )*/
/*Se modifico Patchs.cpp*/
/*Se modifico PrintPlayer.cpp*/
/*Se modifico ServerList.cpp ( Se anula la linea "this->Init()" de ServerList.cpp )*/
/*Se modifico Window.cpp*/
/**/

//---------------------------------------------------------------------------------------------
CWideScreen gCWideScreen;
CWideScreen::CWideScreen() {}
CWideScreen::~CWideScreen() {}
//---------------------------------------------------------------------------------------------

float WConvertX(float x)
{
return x * (float)WindowWidth / gCWideScreen.numW;
}

void WRenderBitmap(int Texture, float x, float y, float Width, float Height, float u, float v, float uWidth, float vHeight, bool Scale, bool StartScale)
{
/*ErrorMessageX*/
//GuildCreatorOpened Esta terminardo.. Solamente se lo omite por la "Texture >= BITMAP_OK && Texture <= BITMAP_CANCEL2"
//Falta terminar SubChestOpened
if(!GuildCreatorOpened && !SubChestOpened)
{
if (x == 213.f || Texture >= BITMAP_OK && Texture <= BITMAP_CANCEL2 ||
(Texture == BITMAP_Message_box && x == 260.f))
{
x = x + gCWideScreen.WCenter;
}
}
if(m_Resolution >= R1280x720)
{
if(Texture == BITMAP_Menu04)
{
x = 900;
}
}
/**/

if (StartScale)
{
x = WConvertX(x);
y = ConvertY(y);
}
if (Scale)
{
Width = WConvertX(Width);
Height = ConvertY(Height);
}

BindTexture(Texture);

float p[4][2];

y = WindowHeight - y;

p[0][0] = x; p[0][1] = y;
p[1][0] = x; p[1][1] = y - Height;
p[2][0] = x + Width; p[2][1] = y - Height;
p[3][0] = x + Width; p[3][1] = y;

float c[4][2];
TEXCOORD(c[0], u, v);
TEXCOORD(c[3], u + uWidth, v);
TEXCOORD(c[2], u + uWidth, v + vHeight);
TEXCOORD(c[1], u, v + vHeight);

glBegin(GL_TRIANGLE_FAN);
for (int i = 0; i < 4; ++i)
{
glTexCoord2f(c[i][0], c[i][1]);
glVertex2f(p[i][0], p[i][1]);
}
glEnd();
}

void WCreateScreenVector(int sx, int sy, vec3_t Target)
{
sx = sx * WindowWidth / /*640*/(int)gCWideScreen.numW;
sy = sy * WindowHeight / 480;
vec3_t p1, p2;
p1[0] = (float)(sx - ScreenCenterX) * PerspectiveX * /*CameraViewFar*/RENDER_ITEMVIEW_FAR;
p1[1] = -(float)(sy - ScreenCenterY) * PerspectiveY * /*CameraViewFar*/RENDER_ITEMVIEW_FAR;
p1[2] = -/*CameraViewFar*/RENDER_ITEMVIEW_FAR;
p2[0] = -CameraMatrix[0][3];
p2[1] = -CameraMatrix[1][3];
p2[2] = -CameraMatrix[2][3];
VectorIRotate(p2, CameraMatrix, MousePosition);
VectorIRotate(p1, CameraMatrix, p2);
VectorAdd(MousePosition, p2, Target);
}

void WProjection(vec3_t Position, int* sx, int* sy)
{
vec3_t TrasformPosition;
VectorTransform(Position, CameraMatrix, TrasformPosition);
*sx = -(int)(TrasformPosition[0] / PerspectiveX / TrasformPosition[2]) + ScreenCenterX;
*sy = (int)(TrasformPosition[1] / PerspectiveY / TrasformPosition[2]) + ScreenCenterY;
*sx = *sx * /*640*/(int)gCWideScreen.numW / (int)WindowWidth;
*sy = *sy * 480 / (int)WindowHeight;
}

void WBeginOpengl(int x, int y, int Width, int Height)
{
if (Width == 640)
Width = (int)gCWideScreen.numW;

x = x * WindowWidth / (int)gCWideScreen.numW;
y = y * WindowHeight / 480;
Width = Width * WindowWidth / /*640*/(int)gCWideScreen.numW;
Height = Height * WindowHeight / 480;

float wFov;
float wangle;
if (m_Resolution >= R1280x720)
{
wFov = (SceneFlag == MAIN_SCENE ? CameraFOV + 4.f : CameraFOV);
wangle = (SceneFlag == MAIN_SCENE ? CameraAngle[0] - -2.f : CameraAngle[0]);
}
else
{
wFov = CameraFOV;
wangle = CameraAngle[0];
}

glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glViewport2(x, y, Width, Height);
gluPerspective2(wFov, (float)Width / (float)Height, CameraViewNear, CameraViewFar * 1.4f);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glRotatef(CameraAngle[1], 0.f, 1.f, 0.f);
if (CameraTopViewEnable == false)
glRotatef(wangle, 1.f, 0.f, 0.f);
glRotatef(CameraAngle[2], 0.f, 0.f, 1.f);
glTranslatef(-CameraPosition[0], -CameraPosition[1], -CameraPosition[2]);
glDisable(GL_ALPHA_TEST);
glEnable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glDepthMask(true);
AlphaTestEnable = false;
TextureEnable = true;
DepthTestEnable = true;
CullFaceEnable = true;
DepthMaskEnable = true;
glDepthFunc(GL_LEQUAL);
glAlphaFunc(GL_GREATER, 0.25f);
if (FogEnable)
{
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_LINEAR);
glFogf(GL_FOG_DENSITY, FogDensity);
glFogfv(GL_FOG_COLOR, FogColor);
}
else
{
glDisable(GL_FOG);
}
GetOpenGLMatrix(CameraMatrix);
}

int WGetTextWidth(char* buff)
{
SIZE sz;

GetTextExtentPoint(m_hFontDC, buff, strlen(buff), &sz);

return ((int)gCWideScreen.numW * sz.cx / WindowWidth);
}

void WRenderText(int iPos_x, int iPos_y, const char* pszText, int iBoxWidth, int iSort, SIZE* lpTextSize)
{
iBoxWidth = m_Resolution >= R1280x720 ? (int)(iBoxWidth * 0.75) : iBoxWidth;
RenderText_1(iPos_x, iPos_y, pszText, iBoxWidth, ((BYTE)iSort != 0) + 1, lpTextSize);
}

void Center_RenderBitmap(int Texture, float x, float y, float Width, float Height, float u, float v, float uWidth, float vHeight, bool Scale, bool StartScale)
{
RenderBitmap(Texture, x + gCWideScreen.WCenter, y, Width, Height, u, v, uWidth, vHeight, Scale, StartScale);
if (m_Resolution >= R1280x720)
{
if (Texture == BITMAP_Menu03_new)
{
EnableAlphaTest(true);
RenderBitmap(WDecorOldTEXTURE, 47.f, 411.f, 144.f, 69.f, 0.f, 0.f, 1.f, 1.f, true, true);
RenderBitmap(WDecorOldTEXTURE, 662.f, 411.f, 144.f, 69.f, 1.f, 0.f, -1.f, 1.f, true, true);
DisableAlphaBlend();
}
}
}

void Center_RenderText(int iPos_x, int iPos_y, const char* pszText, int iBoxWidth, int iSort, SIZE* lpTextSize)
{
SIZE sz;
GetTextExtentPoint(m_hFontDC, pszText, strlen(pszText), &sz);
RenderText((320 - (((int)gCWideScreen.numW * sz.cx / WindowWidth) >> 1)) + (int)gCWideScreen.WCenter, iPos_y, (char*)pszText, iBoxWidth, iSort, lpTextSize);
}

void Center_RenderTextNotice(int iPos_x, int iPos_y, const char* pszText, int iBoxWidth, int iSort, SIZE* lpTextSize)
{
SIZE sz;
GetTextExtentPoint(m_hFontDC, pszText, strlen(pszText), &sz);
RenderText_1((320 - (((int)gCWideScreen.numW * sz.cx / WindowWidth) >> 1)) + (int)gCWideScreen.WCenter, iPos_y, (char*)pszText, iBoxWidth, iSort, lpTextSize);
}

void Center_RenderColor(float x, float y, float width, float height)
{
RenderColor(x + gCWideScreen.WCenter, y, width, height);
}

void Center_RenderTipText(int sx, int sy, char* Text)
{
RenderTipText(sx + (int)gCWideScreen.WCenter, sy, Text);
}

void Center_RenderNumber2D(float x, float y, int Num, float Width, float Height)
{
RenderNumber2D(x + gCWideScreen.WCenter, y, Num, Width, Height);
}

void GlobalText454_RenderText(int iPos_x, int iPos_y, const char* pszText, int iBoxWidth, int iSort, SIZE* lpTextSize)
{
SIZE Size;
char Text[100];

strcpy(Text, GlobalText[454]);
GetTextExtentPointA(g_hDC, Text, lstrlen(Text), &Size);
RenderText((335 + (int)gCWideScreen.WCenter) - Size.cx * (int)gCWideScreen.numW / WindowWidth, iPos_y, Text, iBoxWidth, iSort, lpTextSize);

strcpy(Text, GlobalText[455]);
GetTextExtentPointA(g_hDC, Text, lstrlen(Text), &Size);
RenderText(335 + (int)gCWideScreen.WCenter, iPos_y, Text, iBoxWidth, iSort, lpTextSize);
}

void WRenderLogInScene()
{
SetCompleteHook(0xE8, 0x0052174D, &Center_RenderBitmap);
SetCompleteHook(0xE8, 0x005217FD, &Center_RenderBitmap);
SetCompleteHook(0xE8, 0x005218AB, &Center_RenderBitmap);
SetDword(0x00521773 + 1, 295 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0052179B + 1, 295 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00521761 + 1, 227 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0052178C + 1, 227 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00521838 + 1, 357 + (DWORD)gCWideScreen.WCenter);
SetDword(0x005218DA + 1, 319 + (DWORD)gCWideScreen.WCenter);
SetDword(0x005217B0 + 1, 323 + (DWORD)gCWideScreen.WCenter);
SetDword(0x005217BB + 1, 393 + (DWORD)gCWideScreen.WCenter);
SetDword(0x005202DB + 2, 323 + (DWORD)gCWideScreen.WCenter);
SetDword(0x005202E3 + 2, 393 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0052185E + 1, 285 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00521869 + 1, 355 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00520F2C + 2, 285 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00520F38 + 2, 355 + (DWORD)gCWideScreen.WCenter);

SetDword(0x00520260 + 2, 293 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00520268 + 2, 417 + (DWORD)gCWideScreen.WCenter);

SetCompleteHook(0xE8, 0x005219AD, &GlobalText454_RenderText);
SetCompleteHook(0xE8, 0x00521A20, &GlobalText454_RenderText);

SetCompleteHook(0xE8, 0x00521B31, &Center_RenderBitmap);
SetCompleteHook(0xE8, 0x00521BC0, &Center_RenderBitmap);

SetDword(0x00521BD2 + 1, 285 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00521BD9 + 1, 355 + (DWORD)gCWideScreen.WCenter);

SetDword(0x00521CAC + 1, 320 + (DWORD)gCWideScreen.WCenter);

SetDword(0x00520190 + 2, 285 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0052019C + 2, 355 + (DWORD)gCWideScreen.WCenter);
}

float EM_ChaosGoblinMouseX1 = 0.f; float EM_ChaosGoblinMouseX2 = 0.f;
void ErrorMessage_ChaosGoblin()
{
SetCompleteHook(0xE8, 0x0051B6DF, &Center_RenderBitmap);
SetCompleteHook(0xE8, 0x0051B727, &Center_RenderBitmap);
SetCompleteHook(0xE8, 0x0051B76A, &Center_RenderBitmap);
SetCompleteHook(0xE8, 0x0051B819, &Center_RenderBitmap);

SetCompleteHook(0xE8, 0x0051B8E0, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051B906, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051B920, &Center_RenderText);

EM_ChaosGoblinMouseX1 = 245.f + gCWideScreen.WCenter; EM_ChaosGoblinMouseX2 = 395.f + gCWideScreen.WCenter;
SetDword(0x0051B7AA + 2, (DWORD)&EM_ChaosGoblinMouseX1);
SetDword(0x0051B7B9 + 2, (DWORD)&EM_ChaosGoblinMouseX2);

SetDword(0x00515A81 + 2, (DWORD)&EM_ChaosGoblinMouseX1);
SetDword(0x00515A90 + 2, (DWORD)&EM_ChaosGoblinMouseX2);

SetCompleteHook(0xE8, 0x0051B894, &Center_RenderText);
}

float XButtonOKCancel_CreateOkMessageBox = 0.f;
void ErrorMessageX()
{
ErrorMessage_ChaosGoblin();

SetCompleteHook(0xE8, 0x0051B11C, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051B176, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051B1C2, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051B211, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051B29A, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051B2E6, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051B335, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051B386, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051B4F3, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051B57A, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051B601, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051B64C, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051C24D, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051C29A, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051C2F2, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051C3DE, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051C467, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051C616, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051C9B2, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051CA88, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051CBA8, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051CC74, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051CCFD, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051CDB8, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051CE61, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051D105, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051D200, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051D32A, &Center_RenderText);
//SetCompleteHook(0xE8, 0x0051D437, &Center_RenderText);//ete ni idea

//Blood Castle
SetCompleteHook(0xE8, 0x0051DB7E, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051DC07, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051DC53, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051DCF3, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051DD6C, &Center_RenderText);
SetCompleteHook(0xE8, 0x0051DDDC, &Center_RenderText);

SetDword(0x0051BBDA + 1, 323 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0051BBE7 + 1, 363 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0051BC62 + 1, 373 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0051BC69 + 1, 413 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0051BAA9 + 1, 234 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0051BAB0 + 1, 304 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0051BB2B + 1, 334 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0051BB32 + 1, 404 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0051BA17 + 1, 284 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0051BA1E + 1, 354 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0051B037 + 1, 260 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0051B03E + 1, 380 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0051B412 + 1, 260 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0051B419 + 1, 380 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0051C037 + 1, 249 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0051C044 + 1, 202 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0051C0E8 + 1, 377 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0051C0F5 + 1, 202 + (DWORD)gCWideScreen.WCenter);

SetDword(0x00517CEB + 1, 323 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00517CDF + 1, 234 + (DWORD)gCWideScreen.WCenter);

SetDword(0x005199B0 + 1, 373 + (DWORD)gCWideScreen.WCenter);
SetDword(0x005199A4 + 1, 334 + (DWORD)gCWideScreen.WCenter);

SetDword(0x0051448D + 2, 260 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00514499 + 2, 380 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00515970 + 2, 260 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0051597C + 2, 380 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00515B89 + 1, 284 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00515B90 + 1, 354 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0051AC2B + 1, 249 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0051AC32 + 1, 202 + (DWORD)gCWideScreen.WCenter);

SetDword(0x0051B9AD + 1, 278 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0051BBBE + 1, 243 + (DWORD)gCWideScreen.WCenter);

SetDword(0x0051D732 + 4, 71 + (DWORD)gCWideScreen.WCenter);//CreateOkMessageBox(0x0051D6F0)
XButtonOKCancel_CreateOkMessageBox = 213.f - gCWideScreen.WCenter;
SetDword(0x0051BFC9 + 2, (DWORD)&XButtonOKCancel_CreateOkMessageBox);
}

void WRenderInterfaceEdge()
{
EnableAlphaTest(true);
glColor3f(1.f, 1.f, 1.f);

RenderBitmap(BITMAP_Interface01, 64.f, 0.f, 256.f + gCWideScreen.WCenter, 86.f, 1.f, 0.f, -1.f, 0.671875f, true, true);
RenderBitmap(BITMAP_Interface02, 0.f, 0.f, 64.0, 256.f, 1.0, 0.f, -1.f, 1.f, true, true);
RenderBitmap(BITMAP_Interface03, 0.f, 256.f, 64.f, 224.f, 1.f, 0.f, -1.f, 0.875f, true, true);
RenderBitmap(BITMAP_Interface04, 64.f, 448.f, 256.f, 32.f, 1.f, 0.f, -1.f, 1.f, true, true);

RenderBitmap(BITMAP_Interface01, 320.f + gCWideScreen.WCenter, 0.f, 256.f + gCWideScreen.WCenter, 86.f, 0.f, 0.f, 1.f, 0.671875f, true, true);
RenderBitmap(BITMAP_Interface02, gCWideScreen.numW - 64.f, 0.f, 64.f, 256.f, 0.f, 0.f, 1.f, 1.f, true, true);
RenderBitmap(BITMAP_Interface03, gCWideScreen.numW - 64.f, 256.f, 64.f, 224.f, 0.f, 0.f, 1.f, 0.875f, true, true);
RenderBitmap(BITMAP_Interface04, gCWideScreen.numW - 256.f, 448.f, 256.f, 32.f, 0.f, 0.f, 1.f, 1.f, true, true);
}

void WRenderCharacterScene()
{
SetCompleteHook(0xE9, 0x005239A0, &WRenderInterfaceEdge);

SetCompleteHook(0xE8, 0x005248E8, &Center_RenderBitmap);
SetCompleteHook(0xE8, 0x00524949, &Center_RenderBitmap);
SetDword(0x005248F9 + 2, 286 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00524905 + 2, 356 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0052243E + 2, 286 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0052244D + 2, 356 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00524A35 + 1, (DWORD)gCWideScreen.numW - 204);
SetDword(0x0052276E + 1, (DWORD)gCWideScreen.numW - 200);

SetCompleteHook(0xE8, 0x005242ED, &Center_RenderBitmap);
SetCompleteHook(0xE8, 0x0052432A, &Center_RenderBitmap);
SetCompleteHook(0xE8, 0x00524397, &Center_RenderBitmap);
SetCompleteHook(0xE8, 0x0052445F, &Center_RenderBitmap);
SetCompleteHook(0xE8, 0x00524528, &Center_RenderBitmap);
SetCompleteHook(0xE8, 0x00524595, &Center_RenderBitmap);
SetCompleteHook(0xE8, 0x005245F8, &Center_RenderBitmap);
SetCompleteHook(0xE8, 0x00524653, &Center_RenderBitmap);

SetCompleteHook(0xE8, 0x005243D8, &Center_RenderColor);
SetCompleteHook(0xE8, 0x0052449B, &Center_RenderColor);

SetCompleteHook(0xE8, 0x005246C6, &Center_RenderText);

SetDword(0x0052468C + 1, 285 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00524796 + 1, 285 + (DWORD)gCWideScreen.WCenter);

SetDword(0x00524409 + 1, 384 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00524414 + 1, 404 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0052433F + 1, 363 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0052434A + 1, 383 + (DWORD)gCWideScreen.WCenter);
SetDword(0x005244D0 + 1, 363 + (DWORD)gCWideScreen.WCenter);
SetDword(0x005244DB + 1, 383 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00524543 + 1, 384 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0052454E + 1, 404 + (DWORD)gCWideScreen.WCenter);
SetDword(0x005245AE + 1, 235 + (DWORD)gCWideScreen.WCenter);
SetDword(0x005245BB + 1, 307 + (DWORD)gCWideScreen.WCenter);
SetDword(0x0052460B + 1, 335 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00524616 + 1, 407 + (DWORD)gCWideScreen.WCenter);

SetDword(0x005229C1 + 2, 363 + (DWORD)gCWideScreen.WCenter);
SetDword(0x005229CF + 2, 383 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00522A12 + 2, 384 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00522A1A + 2, 404 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00522A53 + 2, 235 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00522A60 + 2, 307 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00522AEC + 2, 335 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00522AF4 + 2, 407 + (DWORD)gCWideScreen.WCenter);

SetDword(0x00522846 + 2, 363 + (DWORD)gCWideScreen.WCenter);
SetDword(0x00522858 + 2, 383 + (DWORD)gCWideScreen.WCenter);
SetDword(0x005228E5 + 2, 384 + (DWORD)gCWideScreen.WCenter);
SetDword(0x005228F1 + 2, 404 + (DWORD)gCWideScreen.WCenter);
}

void WUIMainFrameWindow_RenderButtons(BYTE a1)
{
if (IsWorkZone(348 + (int)gCWideScreen.WCenter, 452, 24, 24))
{
RenderTipText(348 + (int)gCWideScreen.WCenter, 437, GlobalText[361]);
}
if (PartyOpened)
RenderBitmap(236, 348.f + gCWideScreen.WCenter, 452.f, 24.f, 24.f, 0.f, 0.f, 0.75f, 0.75f, true, true);

if (IsWorkZone(379 + (int)gCWideScreen.WCenter, 452, 24, 24))
{
RenderTipText(379 + (int)gCWideScreen.WCenter, 437, GlobalText[362]);
}
if (CharacterOpened)
RenderBitmap(237, 379.f + gCWideScreen.WCenter, 452.f, 24.f, 24.f, 0.f, 0.f, 0.75f, 0.75f, true, true);

if (IsWorkZone(410 + (int)gCWideScreen.WCenter, 452, 24, 24))
{
RenderTipText(410 + (int)gCWideScreen.WCenter, 437, GlobalText[363]);
}
if (InventoryOpened)
RenderBitmap(238, 410.f + gCWideScreen.WCenter, 452.f, 24.f, 24.f, 0.f, 0.f, 0.75f, 0.75f, true, true);

if (IsWorkZone(582 + (int)gCWideScreen.WCenter, 459, 24, 24))
{
RenderTipText(582 + (int)gCWideScreen.WCenter, 444, GlobalText[364]);
}
if (GuildOpened)
RenderBitmap(250, 582.f + gCWideScreen.WCenter, 459.f, 52.f, 18.f, 0.f, 0.f, 0.8125f, 0.5625f, true, true);

EnableAlphaTest(true);
}

float HPMouseX1 = 0.f;float HPMouseX2 = 0.f;
float MPMouseX1 = 0.f;float MPMouseX2 = 0.f;
float BPMouseX1 = 0.f;float BPMouseX2 = 0.f;
float SkillBar = 0.f;
void WUIMainFrameWindow()
{
//SetCompleteHook(0xE8, 0x004BD300, &Center_RenderBitmap);//&this->RenderFullMap(kayito 97k)
//SetCompleteHook(0xE8, 0x004BD332, &Center_RenderBitmap);//&this->RenderZoom(kayito 97k)
SetCompleteHook(0xE8, 0x004BD364, &Center_RenderBitmap);
SetCompleteHook(0xE8, 0x004BD602, &Center_RenderBitmap);
SetCompleteHook(0xE8, 0x004BD632, &Center_RenderBitmap);

SetCompleteHook(0xE8, 0x004BD9F8, &Center_RenderTipText);
SetCompleteHook(0xE8, 0x004BDAC2, &Center_RenderTipText);
SetCompleteHook(0xE8, 0x004BD069, &Center_RenderTipText);
HPMouseX1 = 97.f + gCWideScreen.WCenter; HPMouseX2 = 150.f + gCWideScreen.WCenter;
MPMouseX1 = 489.f + gCWideScreen.WCenter;MPMouseX2 = 542.f + gCWideScreen.WCenter;
BPMouseX1 = 551.f + gCWideScreen.WCenter;BPMouseX2 = 566.f + gCWideScreen.WCenter;
SetDword(0x004BD99D + 2, (DWORD)&HPMouseX1);SetDword(0x004BD9AA + 2, (DWORD)&HPMouseX2);
SetDword(0x004BDA64 + 2, (DWORD)&MPMouseX1);SetDword(0x004BDA71 + 2, (DWORD)&MPMouseX2);
SetDword(0x004BD01C + 2, (DWORD)&BPMouseX1);SetDword(0x004BD029 + 2, (DWORD)&BPMouseX2);

/*Pociones*/
SetDword(0x004BFED0 + 1, 208 + (DWORD)gCWideScreen.WCenter);
SetDword(0x004B5EC8 + 1, 208 + (DWORD)gCWideScreen.WCenter);
SetDword(0x004BFF29 + 2, 301 + (DWORD)gCWideScreen.WCenter);
SetCompleteHook(0xE8, 0x004BE4C2, &Center_RenderNumber2D);
/**/

SetCompleteHook(0xE8, 0x004BE0F9, &Center_RenderNumber2D);//coord
SetCompleteHook(0xE8, 0x004BE1CC, &Center_RenderNumber2D);//coord

/*Skill*/
SetDword(0x004B3D57 + 1, 304 + (DWORD)gCWideScreen.WCenter);
SetDword(0x004B3D62 + 1, 336 + (DWORD)gCWideScreen.WCenter);
SetDword(0x004B3D8A + 6, 320 + (DWORD)gCWideScreen.WCenter);
SetDword(0x004B3E23 + 1, 320 + (DWORD)gCWideScreen.WCenter);
SetDword(0x004BDE24 + 1, 304 + (DWORD)gCWideScreen.WCenter);
SkillBar = 320.f + gCWideScreen.WCenter;
SetDword(0x004BDE85 + 2, (DWORD)&SkillBar);
/**/

SetCompleteHook(0xE8, 0x004BE012, &WUIMainFrameWindow_RenderButtons);
MemorySet(0x004BDACC, 0x90, 0x25E); // Remove Mouse,RenderBitmap,RenderTipText Button
//-- Button Main::Party
SetDword(0x004B22D2 + 2, 348 + (DWORD)gCWideScreen.WCenter);
SetDword(0x004B22DE + 2, 372 + (DWORD)gCWideScreen.WCenter);
//-- Button Main::Character
SetDword(0x004B2C3C + 2, 379 + (DWORD)gCWideScreen.WCenter);
SetDword(0x004B2C48 + 2, 403 + (DWORD)gCWideScreen.WCenter);
//-- Button Main::Inventory
SetDword(0x004B3500 + 2, 410 + (DWORD)gCWideScreen.WCenter);
SetDword(0x004B350C + 2, 434 + (DWORD)gCWideScreen.WCenter);
//-- Button Main::Guild
SetDword(0x004B1967 + 2, 582 + (DWORD)gCWideScreen.WCenter);
SetDword(0x004B1973 + 2, 634 + (DWORD)gCWideScreen.WCenter);
//-- Button Main::Skill
SetDword(0x004B3D57 + 1, 304 + (DWORD)gCWideScreen.WCenter);
SetDword(0x004B3D62 + 1, 336 + (DWORD)gCWideScreen.WCenter);
SetDword(0x004B3D8A + 6, 320 + (DWORD)gCWideScreen.WCenter);
SetDword(0x004B3E23 + 1, 320 + (DWORD)gCWideScreen.WCenter);
SetDword(0x004BDE24 + 1, 304 + (DWORD)gCWideScreen.WCenter);

/*Chat*/
SetCompleteHook(0xE8, 0x004BE562, &Center_RenderBitmap);
SetCompleteHook(0xE8, 0x004BE592, &Center_RenderBitmap);
SetCompleteHook(0xE8, 0x004BE701, &Center_RenderBitmap);
SetDword(0x004BE5DA + 1, 191 + (DWORD)gCWideScreen.WCenter);
SetDword(0x004BE5F5 + 1, 376 + (DWORD)gCWideScreen.WCenter);
SetDword(0x004BE667 + 1, 376 + (DWORD)gCWideScreen.WCenter);
SetDword(0x004BB801 + 1, 186 + (DWORD)gCWideScreen.WCenter);
SetDword(0x004BB808 + 1, 376 + (DWORD)gCWideScreen.WCenter);
SetDword(0x004BB85D + 1, 376 + (DWORD)gCWideScreen.WCenter);//mm
SetDword(0x004BB8C3 + 1, 434 + (DWORD)gCWideScreen.WCenter);//mm
SetDword(0x004BB864 + 1, 434 + (DWORD)gCWideScreen.WCenter);
SetDword(0x004BB8CA + 1, 454 + (DWORD)gCWideScreen.WCenter);
SetFloat(0x005590B0 + 0, 295.0f + gCWideScreen.WCenter); //-- chat buttons
SetDword(0x0040E288 + 1, 160 + (DWORD)gCWideScreen.WCenter); //-- InputX
SetDword(0x0040E9FD + 1, 460 + (DWORD)gCWideScreen.WCenter); //-InputX
/**/
}

void CWideScreen::InfoWinPos(DWORD* This, int x, int y)
{
if (x == 186)//g_bUseChatListBox
x = x + (DWORD)gCWideScreen.WCenter;
/*Este HDP no actualiza cuando se cambia de resolucion(flashback del S6)*/
else if (x >= 460)//GuildInfoWindowPos
x = (DWORD)gCWideScreen.numW - 180;
/**/
This[11] = x;
This[12] = y;
}

void CWideScreen::Load()
{
gServerList.Init();
gOptionsMenu.Init();

SetCompleteHook(0xE9, 0x005125A0, &WRenderBitmap);
SetCompleteHook(0xE9, 0x00511950, &WConvertX);
SetCompleteHook(0xE9, 0x005112F0, &WCreateScreenVector);
SetCompleteHook(0xE9, 0x005113F0, &WProjection);
SetCompleteHook(0xE9, 0x005119B0, &WBeginOpengl);
SetCompleteHook(0xE9, 0x0047F650, &WRenderText);

SetDword(0x0041981E + 2, (DWORD)gCWideScreen.numW);//Limite del Mouse
SetDword(0x00525B67 + 2, (m_Resolution >= R1280x720 ? 480 : 432));//Limite Zona negra(432)

SetCompleteHook(0xE8, 0x0047FDBE, &Center_RenderTextNotice);

WRenderLogInScene();
WRenderCharacterScene();
ErrorMessageX();
WUIMainFrameWindow();

SetCompleteHook(0xE8, 0x00524BE9, &Center_RenderBitmap);//LoadingScene
SetCompleteHook(0xE8, 0x00524C16, &Center_RenderBitmap);//LoadingScene
SetCompleteHook(0xE8, 0x00524C46, &Center_RenderBitmap);//LoadingScene

/*RenderSands*/
SetFloat(0x004BC036 + 1, gCWideScreen.numW);//Width
SetFloat(0x004BC082 + 1, gCWideScreen.numW);//Width
SetFloat(0x004BC031 + 1, 480.f);//Height
SetFloat(0x004BC07D + 1, 480.f);//Height

/*Ventanas (450 = 190 , 260 = 380)*/
SetDword(0x004CB686 + 1, (DWORD)gCWideScreen.numW - 380);//GetScreenWidth(260)
SetDword(0x004CB6E0 + 1, (DWORD)gCWideScreen.numW - 190);//GetScreenWidth(450)
SetDword(0x004CB6D9 + 1, (DWORD)gCWideScreen.numW);//GetScreenWidth(640)

SetCompleteHook(0xE9, 0x0040C690, &InfoWinPos);

//Inventory
SetDword(0x004F0A72 + 1, (DWORD)gCWideScreen.numW - 190);
SetDword(0x004F0A79 + 1, (DWORD)gCWideScreen.numW - 380);
//Trade
SetDword(0x004F134D + 1, (DWORD)gCWideScreen.numW - 380);
SetDword(0x004F1352 + 6, (DWORD)gCWideScreen.numW - 380);
//Stats
SetDword(0x004F5B9B + 1, (DWORD)gCWideScreen.numW - 190);
//Storage(Falta mover subventana Lock)
SetDword(0x004F318B + 1, (DWORD)gCWideScreen.numW - 380);
SetDword(0x004F3190 + 6, (DWORD)gCWideScreen.numW - 380);
//Shops
SetDword(0x004F2132 + 1, (DWORD)gCWideScreen.numW - 380);
SetDword(0x004F2137 + 6, (DWORD)gCWideScreen.numW - 380);
//Guild
SetDword(0x004F5A75 + 1, (DWORD)gCWideScreen.numW - 190);
SetDword(0x004F585B + 1, (DWORD)gCWideScreen.numW - 190);//GuildCreator
//Party
SetDword(0x004F5B7F + 1, (DWORD)gCWideScreen.numW - 190);
//Party Bar
SetDword(0x004EFD0F + 4, (DWORD)gCWideScreen.numW);
SetDword(0x004EFD1B + 4, (DWORD)gCWideScreen.numW - 190);
SetDword(0x004EFCBB + 4, (DWORD)gCWideScreen.numW - 380);
//Chaos Goblin
SetDword(0x004F280A + 1, (DWORD)gCWideScreen.numW - 380);
SetDword(0x004F280F + 6, (DWORD)gCWideScreen.numW - 380);
//Blood Castle
SetDword(0x004F3F44 + 1, (DWORD)gCWideScreen.numW - 380);
SetDword(0x004F3F49 + 6, (DWORD)gCWideScreen.numW - 380);
//Devil Square
SetDword(0x004F3C78 + 1, (DWORD)gCWideScreen.numW - 380);
SetDword(0x004F3C7D + 6, (DWORD)gCWideScreen.numW - 380);
//Golden Archer(Falta mover subventanas)
SetDword(0x004F46D6 + 1, (DWORD)gCWideScreen.numW - 190);
SetDword(0x004F46DB + 6, (DWORD)gCWideScreen.numW - 190);
/**/
}



Creditos
Kapocha33
Bon Dia

Dakosmu

#1
ServerList.cpp

#include "stdafx.h"
#include "ServerList.h"

/*WideScreen*/
#include "CWideScreen.h"
/**/

CServerList gServerList;

CServerList::CServerList()
{
memset(this->m_ServerListInfo, 0, sizeof(this->m_ServerListInfo));

//this->Init();
}

CServerList::~CServerList()
{

}

void CServerList::Init()
{
SetByte(0x0051F053, 0xEB);

SetCompleteHook(0xE9, 0x0051F0CF, 0x0051F138);

SetByte(0x0051F13D, 0x50);

SetCompleteHook(0xE8, 0x0051F1AE, &this->MultiServerNameChange);

SetCompleteHook(0xE8, 0x004ED016, &this->ServerNameChange); //Ingame Character

SetCompleteHook(0xE8, 0x0051F357, &this->ServerBoxTexture); // Server
SetCompleteHook(0xE8, 0x0051F5FD, &this->ServerBoxTexture); // ServerList
SetCompleteHook(0xE8, 0x0051F761, &this->ServerBoxTexture); // ServerListBar
SetCompleteHook(0xE8, 0x0051F7F7, &this->ServerBoxTexture); // ServerListBar

SetCompleteHook(0xE8, 0x0051F39E, &this->ServerBoxText); // Server
SetCompleteHook(0xE8, 0x0051F688, &this->ServerBoxText); // ServerList

/*WideScreen*/
SetDword(0x0051E8B7 + 1, (150 + 135) + (DWORD)gCWideScreen.WCenter); // ServerMouseX
SetDword(0x0051E8A5 + 1, (375 + 135) + (DWORD)gCWideScreen.WCenter); // ServerMouseX
SetDword(0x0051EC8F + 1, (230 + 135) + (DWORD)gCWideScreen.WCenter); // ServerListMouseX
SetDword(0x0051EC9A + 1, (364 + 135) + (DWORD)gCWideScreen.WCenter); // ServerListMouseX
/**/
}

void CServerList::MultiServerNameChange(char* Text, char* Format, char* ServerName, int ServerCode, char* TextLine)
{
wsprintf(Text, "%s", gServerList.m_ServerListInfo[ServerCode]);
}

void CServerList::ServerNameChange(char* Text, char* Format, DWORD arg1, DWORD arg2)
{
wsprintf(Text, "%s", gServerList.m_ServerListInfo[(abs((int)((*(DWORD*)(0x00561694) - 23) * 20)) + (*(DWORD*)(0x0056169C) - 1))]);
}

void CServerList::GCCustomServerListRecv(PMSG_CUSTOM_SERVER_LIST_RECV* lpMsg)
{
int count = MAKE_NUMBERW(lpMsg->count[0], lpMsg->count[1]);

for (int n = 0; n < count; n++)
{
SERVER_LIST_INFO* lpInfo = (SERVER_LIST_INFO*)(((BYTE*)lpMsg) + sizeof(PMSG_CUSTOM_SERVER_LIST_RECV) + (sizeof(SERVER_LIST_INFO) * n));

wsprintf(gServerList.m_ServerListInfo[lpInfo->ServerCode], "%s", lpInfo->ServerName);
}
}

void CServerList::ServerBoxTexture(int Texture, float x, float y, float Width, float Height, float u, float v, float uWidth, float vHeight, bool Scale, bool StartScale)
{
/*WideScreen*/
RenderBitmap(Texture, (x + 135.0f) + gCWideScreen.WCenter, y, Width, Height, u, v, uWidth, vHeight, Scale, StartScale);
/**/
}

void CServerList::ServerBoxText(int iPos_x, int iPos_y, char* pszText, int iBoxWidth, int iSort, SIZE* lpTextSize)
{
/*WideScreen*/
RenderText((iPos_x + 135) + (int)gCWideScreen.WCenter, iPos_y, pszText, iBoxWidth, iSort, lpTextSize);
/**/
}


PrintPlayer.cpp

#include "stdafx.h"
#include "PrintPlayer.h"
#include "Protect.h"

/*WideScreen*/
#include "CWideScreen.h"
/**/


CPrintPlayer gPrintPlayer;

CPrintPlayer::CPrintPlayer()
{
this->ViewIndex = 0;

this->ViewReset = 0;

this->ViewGrandReset = 0;

this->ViewValue = 0;

this->ViewPoint = 0;

this->ViewCurHP = 0;

this->ViewMaxHP = 0;

this->ViewCurMP = 0;

this->ViewMaxMP = 0;

this->ViewCurBP = 0;

this->ViewMaxBP = 0;

this->ViewDamageHP = 0;

this->ViewExperience = 0;

this->ViewNextExperience = 0;

this->ViewStrength = 0;

this->ViewDexterity = 0;

this->ViewVitality = 0;

this->ViewEnergy = 0;

this->ViewAddStrength = 0;

this->ViewAddDexterity = 0;

this->ViewAddVitality = 0;

this->ViewAddEnergy = 0;

this->ViewPhysiSpeed = 0;

this->ViewMagicSpeed = 0;
}

CPrintPlayer::~CPrintPlayer()
{

}

void CPrintPlayer::Init()
{
SetCompleteHook(0xE8, 0x004BD98F, &this->RenderCircleHPMP); // HP bottle

SetCompleteHook(0xE8, 0x004BDA56, &this->RenderCircleHPMP); // MP bottle

SetCompleteHook(0xE8, 0x004BCFF2, &this->RenderCircleAG); // BP bottle

SetCompleteHook(0xE8, 0x004BD9E7, &this->RenderTextHP); // text.bmd 358: "Life: %d/%d"

SetCompleteHook(0xE8, 0x004EE8E9, &this->RenderTextHP); // text.bmd 211: "HP: %d / %d"

SetCompleteHook(0xE8, 0x004BE2C5, &this->RenderNumberHP); // Render the number of HP

SetCompleteHook(0xE8, 0x004BDAAE, &this->RenderTextMP); // text.bmd 359: "Mana: %d/%d"

SetCompleteHook(0xE8, 0x004EE9DC, &this->RenderTextMP); // text.bmd 213: "Mana: %d / %d"

SetCompleteHook(0xE8, 0x004BE2EC, &this->RenderNumberMP); // Render the number of MP

SetCompleteHook(0xE8, 0x004BD055, &this->RenderTextBP); // text.bmd 214: "A G: %d / %d"

SetCompleteHook(0xE8, 0x004BD00C, &this->RenderNumberBP); // Render the number of BP

SetCompleteHook(0xE8, 0x004ED48F, &this->RenderTextExperience); // text.bmd 201: "Exp: %u/%u"

SetCompleteHook(0xE8, 0x004BC0F8, &this->RenderExperience); // Render the experience bar and number

SetCompleteHook(0xE8, 0x004EEE67, &this->RenderTextLevelUpPoints); // text.bmd 217: "Point: %d"

SetCompleteHook(0xE8, 0x004ED7E3, &this->RenderTextStrength); // text.bmd 202: "Strength: %d"

SetCompleteHook(0xE8, 0x004EE452, &this->RenderTextDexterity); // text.bmd 205: "Agility: %d"

SetCompleteHook(0xE8, 0x004EE85B, &this->RenderTextVitality); // text.bmd 210: "Vitality: %d"

SetCompleteHook(0xE8, 0x004EE95E, &this->RenderTextEnergy); // text.bmd 212: "Energy: %d"

SetCompleteHook(0xE9, 0x0047DD95, &this->PrintPlayerSetAttackSpeed); // Set the attack speed

SetCompleteHook(0xE8, 0x0042AD92, &this->RenderDamageHP); // Damage number on attack

SetCompleteHook(0xE8, 0x0042B38E, &this->RenderDamageHP); // Damage number on attack

SetCompleteHook(0xE8, 0x0042B402, &this->RenderDamageHP); // Damage number on attack

SetCompleteHook(0xE8, 0x0042DA3D, &this->RenderDamageHP); // Damage number on attack

SetCompleteHook(0xE8, 0x0042E2CA, &this->RenderDamageHP); // Damage number on attack

SetCompleteHook(0xE8, 0x0042E2FE, &this->RenderDamageHP); // Damage number on attack

SetCompleteHook(0xE8, 0x0042ED2C, &this->RenderDamageHP); // Damage number on attack

SetCompleteHook(0xE8, 0x0042ED60, &this->RenderDamageHP); // Damage number on attack
}

void CPrintPlayer::RenderCircleHPMP(int Texture, float x, float y, float Width, float Height, float u, float v, float uWidth, float vHeight, bool Scale, bool StartScale)
{
float HP = (float)(gPrintPlayer.ViewMaxHP - gPrintPlayer.ViewCurHP) / (float)gPrintPlayer.ViewMaxHP;

float MP = (float)(gPrintPlayer.ViewMaxMP - gPrintPlayer.ViewCurMP) / (float)gPrintPlayer.ViewMaxMP;

y = ((Texture == 0xEB) ? MP : HP) * 48.0f + 432.0f;

Height = 48.0f - ((Texture == 0xEB) ? MP : HP) * 48.0f;

v = ((Texture == 0xEB) ? MP : HP) * 48.0f / 64.0f;

vHeight = (1.0f - ((Texture == 0xEB) ? MP : HP)) * 48.0f / 64.0f;

return RenderBitmap(Texture, x + gCWideScreen.WCenter, y, Width, Height, u, v, uWidth, vHeight, Scale, StartScale);//WideScreen
}

void CPrintPlayer::RenderCircleAG(int Texture, float x, float y, float Width, float Height, float u, float v, float uWidth, float vHeight, bool Scale, bool StartScale)
{
float BP = (float)(gPrintPlayer.ViewMaxBP - gPrintPlayer.ViewCurBP) / (float)gPrintPlayer.ViewMaxBP;

y = BP * 36.0f + 438.0f;

Height = 36.0f - BP * 36.0f;

v = BP * 36.0f / 64.0f;

vHeight = (1.0f - BP) * 36.0f / 64.0f;

return RenderBitmap(Texture, x + gCWideScreen.WCenter, y, Width, Height, u, v, uWidth, vHeight, Scale, StartScale);//WideScreen
}

void CPrintPlayer::RenderTextHP(char* Dest, char* Format)
{
wsprintf(Dest, Format, gPrintPlayer.ViewCurHP, gPrintPlayer.ViewMaxHP);
}

float CPrintPlayer::RenderNumberHP(float x, float y, int Num, float Width, float Height)
{
return RenderNumber2D(x + gCWideScreen.WCenter, y, gPrintPlayer.ViewCurHP, 9.0f, 10.0f);//WideScreen
}

void CPrintPlayer::RenderTextMP(char* Dest, char* Format)
{
wsprintf(Dest, Format, gPrintPlayer.ViewCurMP, gPrintPlayer.ViewMaxMP);
}

float CPrintPlayer::RenderNumberMP(float x, float y, int Num, float Width, float Height)
{
return RenderNumber2D((x - 20) + gCWideScreen.WCenter, y, gPrintPlayer.ViewCurMP, 9.0f, 10.0f);//WideScreen
}

void CPrintPlayer::RenderTextBP(char* Dest, char* Format)
{
wsprintf(Dest, Format, gPrintPlayer.ViewCurBP, gPrintPlayer.ViewMaxBP);
}

float CPrintPlayer::RenderNumberBP(float x, float y, int Num, float Width, float Height)
{
return RenderNumber2D(x + gCWideScreen.WCenter, y, gPrintPlayer.ViewCurBP, 9.0f, 10.0f);//WideScreen
}

void CPrintPlayer::RenderTextExperience(char* Dest, char* Format)
{
wsprintf(Dest, Format, gPrintPlayer.ViewExperience, gPrintPlayer.ViewNextExperience);
}

void CPrintPlayer::RenderExperience()
{
STRUCT_DECRYPT;

WORD wLevel = *(WORD*)(*(DWORD*)(CharacterAttribute)+0x0E); // current level

STRUCT_ENCRYPT;

WORD wPriorLevel = wLevel - 1;

DWORD dwPriorExperience = 0;

if (wPriorLevel > 0)
{
dwPriorExperience = (((wPriorLevel + 9) * wPriorLevel) * wPriorLevel) * 10;

if (wPriorLevel > 255)
{
int iLevelOverN = wPriorLevel - 255;

dwPriorExperience += (((iLevelOverN + 9) * iLevelOverN) * iLevelOverN) * 1000;
}
}

DWORD RequiredExp = gPrintPlayer.ViewNextExperience - dwPriorExperience;

DWORD ActualExp = gPrintPlayer.ViewExperience - dwPriorExperience;

float TotalBarRate = (float)ActualExp / (float)RequiredExp;

float Width = TotalBarRate * 198.0f;

int Number = (int)((TotalBarRate * 100.0f) / 10.0f);

int Height = 4;

int X = 221;

int Y = 439;

glColor3f(0.92f, 0.8f, 0.34f);

RenderColor((float)X + gCWideScreen.WCenter, (float)Y, Width, (float)Height);//WideScreen

EnableAlphaTest(true);

glColor3f(0.91f, 0.81f, 0.6f);

// experience bar number
RenderNumber2D(425.0f + gCWideScreen.WCenter, 434.0f, Number, 9.0f, 10.0f);//WideScreen

DisableAlphaBlend();

glColor3f(1.0f, 1.0f, 1.0f);

Width = 198.0f;

if (IsWorkZone(X, Y, (int)Width, Height))
{
char strTipText[256];

wsprintf(strTipText, GetTextLine(201), gPrintPlayer.ViewExperience, gPrintPlayer.ViewNextExperience); // text.bmd 201: "Exp: %u/%u"

RenderTipText((X + 2) + (int)gCWideScreen.WCenter, Y - 15, strTipText);//WideScreen
}
}

void CPrintPlayer::RenderTextLevelUpPoints(char* Dest, char* Format)
{
wsprintf(Dest, Format, gPrintPlayer.ViewPoint);
}

void CPrintPlayer::RenderTextStrength(char* Dest, char* Format)
{
wsprintf(Dest, Format, gPrintPlayer.ViewStrength);
}

void CPrintPlayer::RenderTextDexterity(char* Dest, char* Format)
{
wsprintf(Dest, Format, gPrintPlayer.ViewDexterity);
}

void CPrintPlayer::RenderTextVitality(char* Dest, char* Format)
{
wsprintf(Dest, Format, gPrintPlayer.ViewVitality);
}

void CPrintPlayer::RenderTextEnergy(char* Dest, char* Format)
{
wsprintf(Dest, Format, gPrintPlayer.ViewEnergy);
}

__declspec(naked) void CPrintPlayer::PrintPlayerSetAttackSpeed()
{
static DWORD PrintPlayerSetAttackSpeedAddress1 = 0x0047DE20;

_asm
{
Mov Edx, gPrintPlayer.ViewPhysiSpeed;
Movzx Eax, Al;
Mov Ecx, Dword Ptr Ds : [gProtect.m_MainInfo.DWMaxAttackSpeed + Eax * 4] ;
And Ecx, 0xFFFF;
Cmp Edx, Ecx;
Jle NEXT1;
Mov Edx, Ecx;
NEXT1:
Lea Esi, [Ebx + 0x38];
Mov Word Ptr Ds : [Esi] , Dx;
Mov Edx, gPrintPlayer.ViewMagicSpeed;
Mov Ecx, Dword Ptr Ds : [gProtect.m_MainInfo.DWMaxAttackSpeed + Eax * 4] ;
And Ecx, 0xFFFF;
Cmp Edx, Ecx;
Jle NEXT2;
Mov Edx, Ecx;
NEXT2:
Lea Edi, [Ebx + 0x44];
Jmp[PrintPlayerSetAttackSpeedAddress1];
}
}

void CPrintPlayer::RenderDamageHP(float Position[3], int Value, float Color[3], float scale, bool bMove)
{
if (Value > 0)
{
Value = gPrintPlayer.ViewDamageHP;
}

CreatePoint(Position, Value, Color, scale, bMove);
}


OptionsMenu.cpp

#include "stdafx.h"
#include "OptionsMenu.h"
#include "Font.h"
#include "Language.h"
#include "Sound.h"
#include "Window.h"

/*WideScreen*/
#include "CWideScreen.h"
/**/

COptionsMenu gOptionsMenu;

COptionsMenu::COptionsMenu()
{
this->CurrentOption = OPTION_NONE;

memset(this->Resolutions, 0, sizeof(this->Resolutions));

this->BoxWidth = 120;

this->BoxHeight = 22;

/*WideScreen*/
//this->MainPosX = ImgCenterScreenPosX((float)this->BoxWidth);//Este pasa a COptionsMenu::Init()
/**/

this->MainPosY = 60.0f;
}

COptionsMenu::~COptionsMenu()
{

}

void COptionsMenu::Init()
{
/*WideScreen*/
this->MainPosX = (gCWideScreen.numW - this->BoxWidth) / 2.f;
/**/

SetCompleteHook(0xE8, 0x0051AF65, &this->CheckErrorMessage);

SetCompleteHook(0xE9, 0x0051B3CA, &this->OptionsWindowUI);

SetCompleteHook(0xE9, 0x00515954, &this->OptionsWindowControl);

MemorySet(0x004C0026, 0x90, 13);
}

void COptionsMenu::CheckErrorMessage()
{
if (!ErrorMessage)
{
gOptionsMenu.CurrentOption = OPTION_NONE;
}

DisableAlphaBlend();
}

_declspec(naked) void COptionsMenu::OptionsWindowUI()
{
static DWORD jmpBack = 0x0051C173;

_asm
{
Pushad;
}

gOptionsMenu.RenderOptionsMenu();

_asm
{
Popad;
Jmp[jmpBack];
}
}

__declspec(naked) void COptionsMenu::OptionsWindowControl()
{
static DWORD jmpBack = 0x0051AE80;

_asm
{
Pushad;
}

if (gOptionsMenu.CheckOptionsMenu())
{
goto EXIT;
}

MouseLButton = false;

MouseLButtonPush = false;

MouseUpdateTime = 0;

MouseUpdateTimeMax = 6;

EXIT:

_asm
{
Popad;
Jmp[jmpBack];
}
}

void COptionsMenu::RenderOptionsMenu()
{
this->backupBgTextColor = SetBackgroundTextColor;

this->backupTextColor = SetTextColor;

switch (this->CurrentOption)
{
case OPTION_GENERAL:
{
this->RenderGeneral();

break;
}

case OPTION_WINDOW:
{
this->RenderScreen();

break;
}

case OPTION_FONT:
{
this->RenderFont();

break;
}

default:
{
this->RenderAllOptions();

break;
}
}

SetBackgroundTextColor = this->backupBgTextColor;

SetTextColor = this->backupTextColor;
}

bool COptionsMenu::CheckOptionsMenu()
{
switch (this->CurrentOption)
{
case OPTION_GENERAL:
{
return this->CheckGeneral();

break;
}

case OPTION_WINDOW:
{
return this->CheckScreen();

break;
}

case OPTION_FONT:
{
return this->CheckFont();

break;
}

default:
{
return this->CheckAllOptions();

break;
}
}

return false;
}

void COptionsMenu::RenderAllOptions()
{
float Width = (float)this->BoxWidth;

float Height = (float)this->BoxHeight;

float PosX = this->MainPosX;

float PosY = this->MainPosY;

SetBackgroundTextColor = Color4b(255, 255, 255, 0);
SetTextColor = Color4b(255, 255, 255, 255);

char Text[32] = { 0 };

/* OPTIONS */
DisableAlphaBlend();
glColor3f(0.8f, 0.6f, 0.4f);
RenderBitmap(240, PosX, PosY, Width, Height, 0.0f, 0.0f, 213.0f / 256.0f, 64.0f / 64.0f, true, true);
sprintf_s(Text, "%s", GetTextLine(385));
EnableAlphaTest(true);
RenderText((int)PosX, CenterTextPosY(Text, (int)(PosY + (Height / 2.0f))), Text, REAL_WIDTH((int)Width), RT3_SORT_CENTER, NULL);
PosY += (Height + 7.0f);

/* GENERAL */
this->RenderBox(PosX, PosY, Width, Height);
sprintf_s(Text, "%s", GetTextLine(910));
EnableAlphaTest(true);
RenderText((int)PosX, CenterTextPosY(Text, (int)(PosY + (Height / 2.0f))), Text, REAL_WIDTH((int)Width), RT3_SORT_CENTER, NULL);
PosY += (Height + 7.0f);

/* SCREEN */
this->RenderBox(PosX, PosY, Width, Height);
sprintf_s(Text, "%s", GetTextLine(911));
EnableAlphaTest(true);
RenderText((int)PosX, CenterTextPosY(Text, (int)(PosY + (Height / 2.0f))), Text, REAL_WIDTH((int)Width), RT3_SORT_CENTER, NULL);
PosY += (Height + 7.0f);

/* FONT */
this->RenderBox(PosX, PosY, Width, Height);
sprintf_s(Text, "%s", GetTextLine(912));
EnableAlphaTest(true);
RenderText((int)PosX, CenterTextPosY(Text, (int)(PosY + (Height / 2.0f))), Text, REAL_WIDTH((int)Width), RT3_SORT_CENTER, NULL);
PosY += (Height + 7.0f);

/* CLOSE */
this->RenderBox(PosX, PosY, Width, Height);
sprintf_s(Text, "%s", GetTextLine(388));
EnableAlphaTest(true);
RenderText((int)PosX, CenterTextPosY(Text, (int)(PosY + (Height / 2.0f))), Text, REAL_WIDTH((int)Width), RT3_SORT_CENTER, NULL);
PosY += (Height + 7.0f);
}

bool COptionsMenu::CheckAllOptions()
{
int Width = this->BoxWidth;

int Height = this->BoxHeight;

int PosX = (int)this->MainPosX;

int PosY = (int)this->MainPosY + (Height + 7);

for (int i = OPTION_GENERAL; i < MAX_OPTIONS; i++)
{
if (IsWorkZone(PosX, PosY, Width, Height))
{
if (MouseLButton && MouseLButtonPush)
{
MouseLButtonPush = false;

MouseUpdateTime = 0;

MouseUpdateTimeMax = 6;

PlayBuffer(25, 0, 0);

this->CurrentOption = (eMenuOptions)i;

return true;
}
}

PosY += (Height + 7);
}

if (this->CheckClose(PosX, PosY))
{
return true;
}

return false;
}

void COptionsMenu::RenderGeneral()
{
float PosX = this->MainPosX;

float PosY = this->MainPosY;

SetBackgroundTextColor = Color4b(255, 255, 255, 0);
SetTextColor = Color4b(255, 255, 255, 255);

this->RenderGeneralTitle(PosX, PosY);
PosY += ((float)this->BoxHeight + 7.0f);

if (SceneFlag == CHARACTER_SCENE || SceneFlag == MAIN_SCENE)
{
this->RenderLanguage(PosX, PosY);
PosY += ((float)this->BoxHeight + 7.0f);
}

this->RenderAutomaticAttack(PosX, PosY);
PosY += ((float)this->BoxHeight + 7.0f);

this->RenderSoundOnWhisper(PosX, PosY);
PosY += ((float)this->BoxHeight + 7.0f);

this->RenderSoundVolume(PosX, PosY);
PosY += ((float)this->BoxHeight + 7.0f);

this->RenderMusicVolume(PosX, PosY);
PosY += ((float)this->BoxHeight + 7.0f);

this->RenderMusicControls(PosX, PosY);
PosY += ((float)this->BoxHeight + 7.0f);

this->RenderBack(PosX, PosY);
}

bool COptionsMenu::CheckGeneral()
{
int PosX = (int)this->MainPosX;

int PosY = (int)this->MainPosY + (this->BoxHeight + 7);

if (SceneFlag == CHARACTER_SCENE || SceneFlag == MAIN_SCENE)
{
if (this->CheckLanguage(PosX, PosY))
{
return true;
}

PosY += (this->BoxHeight + 7);
}

if (this->CheckAutomaticAttack(PosX, PosY))
{
return true;
}

PosY += (this->BoxHeight + 7);

if (this->CheckSoundOnWhisper(PosX, PosY))
{
return true;
}

PosY += (this->BoxHeight + 7);

if (this->CheckSoundVolume(PosX, PosY))
{
return true;
}

PosY += (this->BoxHeight + 7);

if (this->CheckMusicVolume(PosX, PosY))
{
return true;
}

PosY += (this->BoxHeight + 7);

if (this->CheckMusicControls(PosX, PosY))
{
return true;
}

PosY += (this->BoxHeight + 7);

if (this->CheckBack(PosX, PosY))
{
return true;
}

return false;
}

void COptionsMenu::RenderGeneralTitle(float PosX, float PosY)
{
DisableAlphaBlend();

glColor3f(0.8f, 0.6f, 0.4f);

RenderBitmap(240, PosX, PosY, (float)this->BoxWidth, (float)this->BoxHeight, 0.0f, 0.0f, 213.0f / 256.0f, 64.0f / 64.0f, true, true);

char Text[64] = { 0 };

sprintf_s(Text, "%s", GetTextLine(910));

EnableAlphaTest(true);

RenderText((int)PosX, CenterTextPosY(Text, ((int)PosY + (this->BoxHeight / 2))), Text, REAL_WIDTH(this->BoxWidth), RT3_SORT_CENTER, NULL);
}

void COptionsMenu::RenderLanguage(float PosX, float PosY)
{
DisableAlphaBlend();

glColor3f(1.0f, 1.0f, 1.0f);

RenderBitmap(240, PosX, PosY, (float)this->BoxWidth, (float)this->BoxHeight, 0.0f, 0.0f, 213.0f / 256.0f, 64.0f / 64.0f, true, true);

char Text[64] = { 0 };

sprintf_s(Text, "%s", gLanguage.iLanguageValues[gLanguage.LangNum].first.c_str());

EnableAlphaTest(true);

RenderText((int)PosX, CenterTextPosY(Text, ((int)PosY + (this->BoxHeight / 2))), Text, REAL_WIDTH(this->BoxWidth), RT3_SORT_CENTER, NULL);

if (gLanguage.LangNum > LANGUAGE_ENGLISH)
{
if (IsWorkZone((int)PosX + 2, (int)PosY + 2, this->BoxHeight, this->BoxHeight))
{
if (MouseLButtonPush)
{
RenderBitmap(0x100, PosX + 2.0f, PosY + 2.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f, true, true);
}
else
{
RenderBitmap(0xFF, PosX + 2.0f, PosY + 2.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f, true, true);
}
}
else
{
RenderBitmap(0xFE, PosX + 2.0f, PosY + 2.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f, true, true);
}
}

if (gLanguage.LangNum < LANGUAGE_PORTUGUESE)
{
if (IsWorkZone((int)PosX + (this->BoxWidth - this->BoxHeight) - 2, (int)PosY + 2, this->BoxHeight, this->BoxHeight))
{
if (MouseLButtonPush)
{
MyRenderBitmapRotate(0x100, PosX + (float)(this->BoxWidth - this->BoxHeight) + 11.0f, PosY + 11.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 180.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f);
}
else
{
MyRenderBitmapRotate(0xFF, PosX + (float)(this->BoxWidth - this->BoxHeight) + 11.0f, PosY + 11.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 180.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f);
}
}
else
{
MyRenderBitmapRotate(0xFE, PosX + (float)(this->BoxWidth - this->BoxHeight) + 11.0f, PosY + 11.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 180.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f);
}
}
}

bool COptionsMenu::CheckLanguage(int PosX, int PosY)
{
if (gLanguage.LangNum > LANGUAGE_ENGLISH)
{
if (IsWorkZone(PosX + 2, PosY + 2, this->BoxHeight, this->BoxHeight))
{
if (MouseLButton && MouseLButtonPush)
{
MouseLButtonPush = false;

MouseUpdateTime = 0;

MouseUpdateTimeMax = 6;

PlayBuffer(25, 0, 0);

sprintf_s(gLanguage.m_Language, "%s", gLanguage.iLanguageValues[gLanguage.LangNum - 1].second.c_str());

gLanguage.ReloadLanguage();
}

return true;
}
}

if (gLanguage.LangNum < LANGUAGE_PORTUGUESE)
{
if (IsWorkZone(PosX + (this->BoxWidth - this->BoxHeight) - 2, PosY + 2, this->BoxHeight, this->BoxHeight))
{
if (MouseLButton && MouseLButtonPush)
{
MouseLButtonPush = false;

MouseUpdateTime = 0;

MouseUpdateTimeMax = 6;

PlayBuffer(25, 0, 0);

sprintf_s(gLanguage.m_Language, "%s", gLanguage.iLanguageValues[gLanguage.LangNum + 1].second.c_str());

gLanguage.ReloadLanguage();
}

return true;
}
}

return false;
}

void COptionsMenu::RenderAutomaticAttack(float PosX, float PosY)
{
this->RenderBox(PosX, PosY, (float)this->BoxWidth, (float)this->BoxHeight);

char Text[64] = { 0 };

sprintf_s(Text, "%s: %s", GetTextLine(386), m_bAutoAttack ? "On" : "Off");

EnableAlphaTest(true);

RenderText((int)PosX, CenterTextPosY(Text, ((int)PosY + (this->BoxHeight / 2))), Text, REAL_WIDTH(this->BoxWidth), RT3_SORT_CENTER, NULL);
}

bool COptionsMenu::CheckAutomaticAttack(int PosX, int PosY)
{
if (IsWorkZone(PosX, PosY, this->BoxWidth, this->BoxHeight))
{
if (MouseLButton && MouseLButtonPush)
{
MouseLButtonPush = false;

MouseUpdateTime = 0;

MouseUpdateTimeMax = 6;

PlayBuffer(25, 0, 0);

m_bAutoAttack ^= 1u;
}

return true;
}

return false;
}

void COptionsMenu::RenderSoundOnWhisper(float PosX, float PosY)
{
this->RenderBox(PosX, PosY, (float)this->BoxWidth, (float)this->BoxHeight);

char Text[64] = { 0 };

sprintf_s(Text, "%s: %s", GetTextLine(387), m_bWhisperSound ? "On" : "Off");

EnableAlphaTest(true);

RenderText((int)PosX, CenterTextPosY(Text, ((int)PosY + (this->BoxHeight / 2))), Text, REAL_WIDTH(this->BoxWidth), RT3_SORT_CENTER, NULL);
}

bool COptionsMenu::CheckSoundOnWhisper(int PosX, int PosY)
{
if (IsWorkZone(PosX, PosY, this->BoxWidth, this->BoxHeight))
{
if (MouseLButton && MouseLButtonPush)
{
MouseLButtonPush = false;

MouseUpdateTime = 0;

MouseUpdateTimeMax = 6;

PlayBuffer(25, 0, 0);

m_bWhisperSound ^= 1u;
}

return true;
}

return false;
}

void COptionsMenu::RenderSoundVolume(float PosX, float PosY)
{
this->RenderBox(PosX, PosY, (float)this->BoxWidth, (float)this->BoxHeight);

float Width = (float)this->BoxWidth / 3.0f;

char Text[64] = { 0 };

sprintf_s(Text, "%s", GetTextLine(913));

EnableAlphaTest(true);

RenderText((int)PosX, CenterTextPosY(Text, ((int)PosY + (this->BoxHeight / 2))), Text, REAL_WIDTH((int)Width), RT3_SORT_CENTER, NULL);

PosX += Width;

Width *= 2.0f;

Width -= 8.0f;

float Height = 8.0f;

PosY += (((float)this->BoxHeight - Height) / 2.0f);

EnableAlphaTest(true);

glColor3f(0.2f, 0.2f, 0.2f);

RenderColor(PosX, PosY, Width + 2.0f, Height);

glColor3f(0.0f, 0.0f, 0.0f);

RenderColor(PosX + 1, PosY + 1.0f, Width, Height - 2.0f);

glColor3f(1.0f, 1.0f, 1.0f);

for (int i = 0; i < MAX_SOUND_LEVEL; i++)
{
if (i >= gSound.SoundVolumeLevel)
{
glColor3f(0.0f, 0.0f, 0.0f);
}
else
{
glColor3f(1.0f, 1.0f, 1.0f);
}

RenderColor(PosX + 1, PosY + 1.0f, (Width / MAX_SOUND_LEVEL), Height - 2.0f);

PosX += (Width / MAX_SOUND_LEVEL);
}

DisableAlphaBlend();

glColor3f(1.0f, 1.0f, 1.0f);
}

bool COptionsMenu::CheckSoundVolume(int PosX, int PosY)
{
float Width = ((float)this->BoxWidth / 3.0f * 2.0f) - 8.0f;

float Height = 8.0f;

PosX += (this->BoxWidth / 3);

PosY += ((this->BoxHeight - (int)Height) / 2);

int newVolumeLevel = 0;

int cursorInicial = PosX;

while (MouseX < cursorInicial || MouseX > cursorInicial + (int)(Width / MAX_SOUND_LEVEL) || MouseY < PosY || MouseY > PosY + ((int)Height - 2) || !MouseLButtonPush)
{
cursorInicial += (int)(Width / MAX_SOUND_LEVEL);

newVolumeLevel++;

if (cursorInicial >= (PosX + (int)Width + 2))
{
return false;
}
}

gSound.UpdateSoundVolumeLevel(newVolumeLevel);

return true;
}

void COptionsMenu::RenderMusicVolume(float PosX, float PosY)
{
this->RenderBox(PosX, PosY, (float)this->BoxWidth, (float)this->BoxHeight);

float Width = (float)this->BoxWidth / 3.0f;

char Text[64] = { 0 };

sprintf_s(Text, "%s", GetTextLine(914));

EnableAlphaTest(true);

RenderText((int)PosX, CenterTextPosY(Text, ((int)PosY + (this->BoxHeight / 2))), Text, REAL_WIDTH((int)Width), RT3_SORT_CENTER, NULL);

PosX += Width;

Width *= 2.0f;

Width -= 8.0f;

float Height = 8.0f;

PosY += (((float)this->BoxHeight - Height) / 2.0f);

EnableAlphaTest(true);

glColor3f(0.2f, 0.2f, 0.2f);

RenderColor(PosX, PosY, Width + 2.0f, Height);

glColor3f(0.0f, 0.0f, 0.0f);

RenderColor(PosX + 1, PosY + 1.0f, Width, Height - 2.0f);

glColor3f(1.0f, 1.0f, 1.0f);

for (int i = 0; i < MAX_MUSIC_LEVEL; i++)
{
if (i >= gSound.MusicVolumeLevel)
{
glColor3f(0.0f, 0.0f, 0.0f);
}
else
{
glColor3f(1.0f, 1.0f, 1.0f);
}

RenderColor(PosX + 1, PosY + 1.0f, (Width / MAX_MUSIC_LEVEL), Height - 2.0f);

PosX += (Width / MAX_MUSIC_LEVEL);
}

DisableAlphaBlend();

glColor3f(1.0f, 1.0f, 1.0f);
}

bool COptionsMenu::CheckMusicVolume(int PosX, int PosY)
{
float Width = ((float)this->BoxWidth / 3.0f * 2.0f) - 8.0f;

float Height = 8.0f;

PosX += (this->BoxWidth / 3);

PosY += ((this->BoxHeight - (int)Height) / 2);

int newVolumeLevel = 0;

int cursorInicial = PosX;

while (MouseX < cursorInicial || MouseX > cursorInicial + (int)(Width / MAX_MUSIC_LEVEL) || MouseY < PosY || MouseY > PosY + ((int)Height - 2) || !MouseLButtonPush)
{
cursorInicial += (int)(Width / MAX_MUSIC_LEVEL);

newVolumeLevel++;

if (cursorInicial >= (PosX + (int)Width + 2))
{
return false;
}
}

gSound.UpdateMusicVolumeLevel(newVolumeLevel);

return true;
}

void COptionsMenu::RenderMusicControls(float PosX, float PosY)
{
float MaxWidth = (float)this->BoxWidth / 2.0f;

float StartPosX = PosX + (MaxWidth / 2.0f);

this->RenderBox(StartPosX, PosY, MaxWidth, (float)this->BoxHeight);

float Width = ((float)this->BoxHeight / 2.0f);

StartPosX += ((MaxWidth - Width) / 2.0f);

PosY += (((float)this->BoxHeight - Width) / 2.0f);

EnableAlphaTest(true);

if (gSound.MusicPlaying)
{
glColor3f(1.0f, 0.0f, 0.0f);

RenderColor(StartPosX, PosY, Width, Width);
}
else
{
glColor3f(0.0f, 1.0f, 0.0f);

RenderTriangleColor(StartPosX, PosY, Width, Width);
}

DisableAlphaBlend();

glColor3f(1.0f, 1.0f, 1.0f);
}

bool COptionsMenu::CheckMusicControls(int PosX, int PosY)
{
int Width = this->BoxWidth / 2;

int StartPosX = (int)PosX + (Width / 2);

if (IsWorkZone(StartPosX, PosY, Width, this->BoxHeight))
{
if (MouseLButton && MouseLButtonPush)
{
MouseLButtonPush = false;

MouseUpdateTime = 0;

MouseUpdateTimeMax = 6;

PlayBuffer(25, 0, 0);

if (gSound.MusicPlaying)
{
gSound.ButtonStopMusic();
}
else
{
gSound.ButtonPlayMusic();
}
}

return true;
}

return false;
}

void COptionsMenu::RenderScreen()
{
float PosX = this->MainPosX;

float PosY = this->MainPosY;

SetBackgroundTextColor = Color4b(255, 255, 255, 0);
SetTextColor = Color4b(255, 255, 255, 255);

this->RenderScreenTitle(PosX, PosY);
PosY += ((float)this->BoxHeight + 7.0f);

this->RenderWindowMode(PosX, PosY);
PosY += ((float)this->BoxHeight + 7.0f);

this->RenderResolutions(PosX, PosY);

this->RenderBack(PosX, PosY);
}

bool COptionsMenu::CheckScreen()
{
int PosX = (int)this->MainPosX;

int PosY = (int)this->MainPosY + (this->BoxHeight + 7);

if (this->CheckWindowMode(PosX, PosY))
{
return true;
}

PosY += (this->BoxHeight + 7);

if (this->CheckResolutions(PosX, PosY))
{
return true;
}

if (this->CheckBack(PosX, PosY))
{
return true;
}

return false;
}

void COptionsMenu::RenderScreenTitle(float PosX, float PosY)
{
DisableAlphaBlend();

glColor3f(0.8f, 0.6f, 0.4f);

RenderBitmap(240, PosX, PosY, (float)this->BoxWidth, (float)this->BoxHeight, 0.0f, 0.0f, 213.0f / 256.0f, 64.0f / 64.0f, true, true);

char Text[64] = { 0 };

sprintf_s(Text, "%s", GetTextLine(911));

EnableAlphaTest(true);

RenderText((int)PosX, CenterTextPosY(Text, ((int)PosY + (this->BoxHeight / 2))), Text, REAL_WIDTH(this->BoxWidth), RT3_SORT_CENTER, NULL);
}

void COptionsMenu::RenderWindowMode(float PosX, float PosY)
{
DisableAlphaBlend();

glColor3f(1.0f, 0.4f, 0.4f);

RenderBitmap(240, PosX, PosY, (float)this->BoxWidth, (float)this->BoxHeight, 0.0f, 0.0f, 213.0f / 256.0f, 64.0f / 64.0f, true, true);

char Text[64] = { 0 };

sprintf_s(Text, "%s", gWindow.iWindowValues[gWindow.m_WindowMode].c_str());

EnableAlphaTest(true);

RenderText((int)PosX, CenterTextPosY(Text, ((int)PosY + (BoxHeight / 2))), Text, REAL_WIDTH(this->BoxWidth), RT3_SORT_CENTER, NULL);

if (gWindow.m_WindowMode > FULL_SCREEN)
{
if (IsWorkZone((int)PosX + 2, (int)PosY + 2, this->BoxHeight, this->BoxHeight))
{
if (MouseLButtonPush)
{
RenderBitmap(0x100, PosX + 2.0f, PosY + 2.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f, true, true);
}
else
{
RenderBitmap(0xFF, PosX + 2.0f, PosY + 2.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f, true, true);
}
}
else
{
RenderBitmap(0xFE, PosX + 2.0f, PosY + 2.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f, true, true);
}
}

if (gWindow.m_WindowMode < BORDERLESS)
{
if (IsWorkZone((int)PosX + (this->BoxWidth - this->BoxHeight) - 2, (int)PosY + 2, this->BoxHeight, this->BoxHeight))
{
if (MouseLButtonPush)
{
MyRenderBitmapRotate(0x100, PosX + (float)(this->BoxWidth - this->BoxHeight) + 11.0f, PosY + 11.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 180.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f);
}
else
{
MyRenderBitmapRotate(0xFF, PosX + (float)(this->BoxWidth - this->BoxHeight) + 11.0f, PosY + 11.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 180.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f);
}
}
else
{
MyRenderBitmapRotate(0xFE, PosX + (float)(this->BoxWidth - this->BoxHeight) + 11.0f, PosY + 11.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 180.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f);
}
}
}

bool COptionsMenu::CheckWindowMode(int PosX, int PosY)
{
if (gWindow.m_WindowMode > FULL_SCREEN)
{
if (IsWorkZone(PosX + 2, PosY + 2, this->BoxHeight, this->BoxHeight))
{
if (MouseLButton && MouseLButtonPush)
{
MouseLButtonPush = false;

MouseUpdateTime = 0;

MouseUpdateTimeMax = 6;

PlayBuffer(25, 0, 0);

gWindow.SetWindowMode(gWindow.m_WindowMode - 1);

gWindow.ChangeWindowState();
}

return true;
}
}

if (gWindow.m_WindowMode < BORDERLESS)
{
if (IsWorkZone(PosX + (this->BoxWidth - this->BoxHeight) - 2, PosY + 2, this->BoxHeight, this->BoxHeight))
{
if (MouseLButton && MouseLButtonPush)
{
MouseLButtonPush = false;

MouseUpdateTime = 0;

MouseUpdateTimeMax = 6;

PlayBuffer(25, 0, 0);

gWindow.SetWindowMode(gWindow.m_WindowMode + 1);

gWindow.ChangeWindowState();
}

return true;
}
}

return false;
}

void COptionsMenu::RenderResolutions(float PosX, float& PosY)
{
this->Resolutions[m_Resolution] = 1;

char Text[64] = { 0 };

for (int i = 0; i < MAX_RESOLUTION_VALUE; i++)
{
DisableAlphaBlend();

glColor3f(1.0f, 1.0f, 1.0f);

RenderBitmap(240, PosX, PosY, (float)this->BoxWidth, (float)this->BoxHeight, 0.0f, 0.0f, 213.0f / 256.0f, 64.0f / 64.0f, true, true);

if (this->Resolutions[i])
{
glColor3f(1.0f, 1.0f, 0.0f);

RenderBitmap(240, PosX, PosY, (float)this->BoxWidth, (float)this->BoxHeight, 0.0f, 0.0f, 213.0f / 256.0f, 64.0f / 64.0f, true, true);

glColor3f(1.0f, 1.0f, 1.0f);

DisableAlphaBlend();
}
else if (IsWorkZone((int)PosX, (int)PosY, this->BoxWidth, this->BoxHeight))
{
EnableAlphaBlend();

glColor3f(0.8f, 0.6f, 0.4f);

RenderBitmap(240, PosX, PosY, (float)this->BoxWidth, (float)this->BoxHeight, 0.0f, 0.0f, 213.0f / 256.0f, 64.0f / 64.0f, true, true);

glColor3f(1.0f, 1.0f, 1.0f);

DisableAlphaBlend();
}

sprintf_s(Text, "%d x %d", gWindow.iResolutionValues[i].first, gWindow.iResolutionValues[i].second);

EnableAlphaTest(true);

RenderText((int)PosX, CenterTextPosY(Text, ((int)PosY + (this->BoxHeight / 2))), Text, REAL_WIDTH(this->BoxWidth), RT3_SORT_CENTER, NULL);

PosY += ((float)this->BoxHeight + 7.0f);
}
}

bool COptionsMenu::CheckResolutions(int PosX, int& PosY)
{
for (int i = 0; i < MAX_RESOLUTION_VALUE; i++)
{
if (IsWorkZone(PosX, PosY, this->BoxWidth, this->BoxHeight))
{
if (MouseLButton && MouseLButtonPush)
{
if (this->Resolutions[i] == 1)
{
return true;
}

MouseLButtonPush = false;

MouseUpdateTime = 0;

MouseUpdateTimeMax = 6;

PlayBuffer(25, 0, 0);

this->Resolutions[m_Resolution] = 0;

gWindow.SetResolution(i);

gWindow.ChangeWindowState();
}

return true;
}

PosY += (this->BoxHeight + 7);
}

return false;
}

void COptionsMenu::RenderFont()
{
float PosX = this->MainPosX;

float PosY = this->MainPosY;

SetBackgroundTextColor = Color4b(255, 255, 255, 0);
SetTextColor = Color4b(255, 255, 255, 255);

this->RenderFontTitle(PosX, PosY);
PosY += ((float)this->BoxHeight + 7.0f);

this->RenderFontStyle(PosX, PosY);
PosY += ((float)this->BoxHeight + 7.0f);

this->RenderFontBold(PosX, PosY);
PosY += ((float)this->BoxHeight + 7.0f);

this->RenderFontItalic(PosX, PosY);
PosY += ((float)this->BoxHeight + 7.0f);

this->RenderFontButtons(PosX, PosY);
PosY += ((float)this->BoxHeight + 7.0f);

this->RenderResetFonts(PosX, PosY);
PosY += ((float)this->BoxHeight + 7.0f);

this->RenderBack(PosX, PosY);
}

bool COptionsMenu::CheckFont()
{
int PosX = (int)this->MainPosX;

int PosY = (int)this->MainPosY + (this->BoxHeight + 7);

if (this->CheckFontStyle(PosX, PosY))
{
return true;
}

PosY += (this->BoxHeight + 7);

if (this->CheckFontBold(PosX, PosY))
{
return true;
}

PosY += (this->BoxHeight + 7);

if (this->CheckFontItalic(PosX, PosY))
{
return true;
}

PosY += (this->BoxHeight + 7);

if (this->CheckFontButtons(PosX, PosY))
{
return true;
}

PosY += (this->BoxHeight + 7);

if (this->CheckResetFonts(PosX, PosY))
{
return true;
}

PosY += (this->BoxHeight + 7);

if (this->CheckBack(PosX, PosY))
{
return true;
}

return false;
}

void COptionsMenu::RenderFontTitle(float PosX, float PosY)
{
DisableAlphaBlend();

glColor3f(0.8f, 0.6f, 0.4f);

RenderBitmap(240, PosX, PosY, (float)this->BoxWidth, (float)this->BoxHeight, 0.0f, 0.0f, 213.0f / 256.0f, 64.0f / 64.0f, true, true);

char Text[64] = { 0 };

sprintf_s(Text, "%s", GetTextLine(912));

EnableAlphaTest(true);

RenderText((int)PosX, CenterTextPosY(Text, ((int)PosY + (this->BoxHeight / 2))), Text, REAL_WIDTH(this->BoxWidth), RT3_SORT_CENTER, NULL);
}

void COptionsMenu::RenderFontStyle(float PosX, float& PosY)
{
DisableAlphaBlend();

glColor3f(1.0f, 1.0f, 1.0f);

RenderBitmap(240, PosX, PosY, (float)this->BoxWidth, (float)this->BoxHeight, 0.0f, 0.0f, 213.0f / 256.0f, 64.0f / 64.0f, true, true);

//GetTextFace(m_hFontDC, sizeof(gFont.MyFontFaceName), gFont.MyFontFaceName);

char Text[64] = { 0 };

try
{
sprintf_s(Text, "%s", gFont.AllFonts.at(gFont.CurrentFontNumber).c_str());
}
catch (...)
{
sprintf_s(Text, "%s", gFont.MyFontFaceName);
}

EnableAlphaTest(true);

RenderText((int)PosX, CenterTextPosY(Text, ((int)PosY + (this->BoxHeight / 2))), Text, REAL_WIDTH(this->BoxWidth), RT3_SORT_CENTER, NULL);

if (gFont.CurrentFontNumber > 0)
{
if (IsWorkZone((int)PosX + 2, (int)PosY + 2, this->BoxHeight, this->BoxHeight))
{
if (MouseLButtonPush)
{
RenderBitmap(0x100, PosX + 2.0f, PosY + 2.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f, true, true);
}
else
{
RenderBitmap(0xFF, PosX + 2.0f, PosY + 2.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f, true, true);
}
}
else
{
RenderBitmap(0xFE, PosX + 2.0f, PosY + 2.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f, true, true);
}
}

if (gFont.CurrentFontNumber < (int)gFont.AllFonts.size() - 1)
{
if (IsWorkZone((int)PosX + (this->BoxWidth - this->BoxHeight) - 2, (int)PosY + 2, this->BoxHeight, this->BoxHeight))
{
if (MouseLButtonPush)
{
MyRenderBitmapRotate(0x100, PosX + (float)(this->BoxWidth - this->BoxHeight) + 11.0f, PosY + 11.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 180.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f);
}
else
{
MyRenderBitmapRotate(0xFF, PosX + (float)(this->BoxWidth - this->BoxHeight) + 11.0f, PosY + 11.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 180.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f);
}
}
else
{
MyRenderBitmapRotate(0xFE, PosX + (float)(this->BoxWidth - this->BoxHeight) + 11.0f, PosY + 11.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 180.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f);
}
}
}

bool COptionsMenu::CheckFontStyle(int PosX, int PosY)
{
if (gFont.CurrentFontNumber > 0)
{
if (IsWorkZone(PosX + 2, PosY + 2, this->BoxHeight, this->BoxHeight))
{
if (MouseLButton && MouseLButtonPush)
{
MouseLButtonPush = false;

MouseUpdateTime = 0;

MouseUpdateTimeMax = 6;

PlayBuffer(25, 0, 0);

gFont.CurrentFontNumber--;

try
{
sprintf_s(gFont.MyFontFaceName, "%s", gFont.AllFonts.at(gFont.CurrentFontNumber).c_str());

gFont.ReloadFont();
}
catch (...)
{
gFont.CurrentFontNumber++;
}
}

return true;
}
}

if (gFont.CurrentFontNumber < (int)gFont.AllFonts.size() - 1)
{
if (IsWorkZone(PosX + (this->BoxWidth - this->BoxHeight) - 2, PosY + 2, this->BoxHeight, this->BoxHeight))
{
if (MouseLButton && MouseLButtonPush)
{
MouseLButtonPush = false;

MouseUpdateTime = 0;

MouseUpdateTimeMax = 6;

PlayBuffer(25, 0, 0);

gFont.CurrentFontNumber++;

try
{
sprintf_s(gFont.MyFontFaceName, "%s", gFont.AllFonts.at(gFont.CurrentFontNumber).c_str());

gFont.ReloadFont();
}
catch (...)
{
gFont.CurrentFontNumber--;
}
}

return true;
}
}

return false;
}

void COptionsMenu::RenderFontBold(float PosX, float& PosY)
{
this->RenderBox(PosX, PosY, (float)this->BoxWidth, (float)this->BoxHeight);

char Text[64] = { 0 };

sprintf_s(Text, "Bold: %s", (gFont.Bold) ? "On" : "Off");

EnableAlphaTest(true);

RenderText((int)PosX, CenterTextPosY(Text, ((int)PosY + (this->BoxHeight / 2))), Text, REAL_WIDTH(this->BoxWidth), RT3_SORT_CENTER, NULL);
}

bool COptionsMenu::CheckFontBold(int PosX, int& PosY)
{
if (IsWorkZone(PosX, PosY, this->BoxWidth, this->BoxHeight))
{
if (MouseLButton && MouseLButtonPush)
{
MouseLButtonPush = false;

MouseUpdateTime = 0;

MouseUpdateTimeMax = 6;

PlayBuffer(25, 0, 0);

gFont.Bold ^= 1;

gFont.ReloadFont();
}

return true;
}

return false;
}

void COptionsMenu::RenderFontItalic(float PosX, float& PosY)
{
this->RenderBox(PosX, PosY, (float)this->BoxWidth, (float)this->BoxHeight);

char Text[64] = { 0 };

sprintf_s(Text, "Italic: %s", (gFont.Italic) ? "On" : "Off");

EnableAlphaTest(true);

RenderText((int)PosX, CenterTextPosY(Text, ((int)PosY + (this->BoxHeight / 2))), Text, REAL_WIDTH(this->BoxWidth), RT3_SORT_CENTER, NULL);
}

bool COptionsMenu::CheckFontItalic(int PosX, int& PosY)
{
if (IsWorkZone(PosX, PosY, this->BoxWidth, this->BoxHeight))
{
if (MouseLButton && MouseLButtonPush)
{
MouseLButtonPush = false;

MouseUpdateTime = 0;

MouseUpdateTimeMax = 6;

PlayBuffer(25, 0, 0);

gFont.Italic ^= 1;

gFont.ReloadFont();
}

return true;
}

return false;
}

void COptionsMenu::RenderFontButtons(float PosX, float& PosY)
{
DisableAlphaBlend();

glColor3f(1.0f, 1.0f, 1.0f);

RenderBitmap(240, PosX, PosY, (float)this->BoxWidth, (float)this->BoxHeight, 0.0f, 0.0f, 213.0f / 256.0f, 64.0f / 64.0f, true, true);

char Text[3] = { 0 };

sprintf_s(Text, "%d", FontHeight);

EnableAlphaTest(true);

RenderText((int)PosX, CenterTextPosY(Text, ((int)PosY + (this->BoxHeight / 2))), Text, REAL_WIDTH(this->BoxWidth), RT3_SORT_CENTER, NULL);

if (FontHeight > 1)
{
if (IsWorkZone((int)PosX + 2, (int)PosY + 2, this->BoxHeight, this->BoxHeight))
{
if (MouseLButtonPush)
{
RenderBitmap(0x100, PosX + 2.0f, PosY + 2.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f, true, true);
}
else
{
RenderBitmap(0xFF, PosX + 2.0f, PosY + 2.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f, true, true);
}
}
else
{
RenderBitmap(0xFE, PosX + 2.0f, PosY + 2.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f, true, true);
}
}

if (IsWorkZone((int)PosX + (this->BoxWidth - this->BoxHeight) - 2, (int)PosY + 2, this->BoxHeight, this->BoxHeight))
{
if (MouseLButtonPush)
{
MyRenderBitmapRotate(0x100, PosX + (float)(this->BoxWidth - this->BoxHeight) + 11.0f, PosY + 11.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 180.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f);
}
else
{
MyRenderBitmapRotate(0xFF, PosX + (float)(this->BoxWidth - this->BoxHeight) + 11.0f, PosY + 11.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 180.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f);
}
}
else
{
MyRenderBitmapRotate(0xFE, PosX + (float)(this->BoxWidth - this->BoxHeight) + 11.0f, PosY + 11.0f, (float)this->BoxHeight - 4.0f, (float)this->BoxHeight - 4.0f, 180.0f, 0.0f, 0.0f, 32.0f / 32.0f, 32.0f / 32.0f);
}
}

bool COptionsMenu::CheckFontButtons(int PosX, int& PosY)
{
if (FontHeight > 1)
{
if (IsWorkZone(PosX + 2, PosY + 2, this->BoxHeight, this->BoxHeight))
{
if (MouseLButton && MouseLButtonPush)
{
MouseLButtonPush = false;

MouseUpdateTime = 0;

MouseUpdateTimeMax = 6;

PlayBuffer(25, 0, 0);

FontHeight -= 1;

gFont.ReloadFont();
}

return true;
}
}

if (IsWorkZone(PosX + (this->BoxWidth - this->BoxHeight) - 2, PosY + 2, this->BoxHeight, this->BoxHeight))
{
if (MouseLButton && MouseLButtonPush)
{
MouseLButtonPush = false;

MouseUpdateTime = 0;

MouseUpdateTimeMax = 6;

PlayBuffer(25, 0, 0);

FontHeight += 1;

gFont.ReloadFont();
}

return true;
}

return false;
}

void COptionsMenu::RenderResetFonts(float PosX, float& PosY)
{
this->RenderBox(PosX, PosY, (float)this->BoxWidth, (float)this->BoxHeight);

char Text[64] = { 0 };

sprintf_s(Text, "%s", GetTextLine(915));

EnableAlphaTest(true);

RenderText((int)PosX, CenterTextPosY(Text, ((int)PosY + (this->BoxHeight / 2))), Text, REAL_WIDTH(this->BoxWidth), RT3_SORT_CENTER, NULL);
}

bool COptionsMenu::CheckResetFonts(int PosX, int& PosY)
{
if (IsWorkZone(PosX, PosY, this->BoxWidth, this->BoxHeight))
{
if (MouseLButton && MouseLButtonPush)
{
MouseLButtonPush = false;

MouseUpdateTime = 0;

MouseUpdateTimeMax = 6;

PlayBuffer(25, 0, 0);

gFont.Bold = 0;

gFont.Italic = 0;

FontHeight = 13;

gFont.CurrentFontNumber = 0;

sprintf_s(gFont.MyFontFaceName, "%s", gFont.AllFonts[gFont.CurrentFontNumber].c_str());

gFont.ReloadFont();
}

return true;
}

return false;
}

void COptionsMenu::RenderClose(float PosX, float PosY)
{
this->RenderBox(PosX, PosY, (float)this->BoxWidth, (float)this->BoxHeight);

char Text[64] = { 0 };

sprintf_s(Text, "%s", GetTextLine(388));

EnableAlphaTest(true);

RenderText((int)PosX, CenterTextPosY(Text, ((int)PosY + (BoxHeight / 2))), Text, REAL_WIDTH(this->BoxWidth), RT3_SORT_CENTER, NULL);
}

bool COptionsMenu::CheckClose(int PosX, int PosY)
{
if (IsWorkZone(PosX, PosY, this->BoxWidth, this->BoxHeight))
{
if (MouseLButton && MouseLButtonPush)
{
MouseLButtonPush = false;

MouseUpdateTime = 0;

MouseUpdateTimeMax = 6;

PlayBuffer(25, 0, 0);

this->CurrentOption = OPTION_NONE;

ErrorMessage = *(BYTE*)0x083A7C28;

*(BYTE*)0x083A7C28 = 0;
}

return true;
}

return false;
}

void COptionsMenu::RenderBack(float PosX, float PosY)
{
this->RenderBox(PosX, PosY, (float)this->BoxWidth, (float)this->BoxHeight);

char Text[64] = { 0 };

sprintf_s(Text, "%s", GetTextLine(916));

EnableAlphaTest(true);

RenderText((int)PosX, CenterTextPosY(Text, ((int)PosY + (BoxHeight / 2))), Text, REAL_WIDTH(this->BoxWidth), RT3_SORT_CENTER, NULL);
}

bool COptionsMenu::CheckBack(int PosX, int PosY)
{
if (IsWorkZone(PosX, PosY, this->BoxWidth, this->BoxHeight))
{
if (MouseLButton && MouseLButtonPush)
{
MouseLButtonPush = false;

MouseUpdateTime = 0;

MouseUpdateTimeMax = 6;

PlayBuffer(25, 0, 0);

this->CurrentOption = OPTION_NONE;
}

return true;
}

return false;
}

void COptionsMenu::RenderBox(float PosX, float PosY, float Width, float Height)
{
DisableAlphaBlend();

glColor3f(1.0f, 1.0f, 1.0f);

RenderBitmap(240, PosX, PosY, Width, Height, 0.0f, 0.0f, 213.0f / 256.0f, 64.0f / 64.0f, true, true);

if (IsWorkZone((int)PosX, (int)PosY, (int)Width, (int)Height))
{
glColor3f(0.8f, 0.6f, 0.4f);

EnableAlphaBlend();

RenderBitmap(240, PosX, PosY, Width, Height, 0.0f, 0.0f, 213.0f / 256.0f, 64.0f / 64.0f, true, true);

glColor3f(1.0f, 1.0f, 1.0f);

DisableAlphaBlend();
}
}

Creditos
Kapocha33
Bon Dia

Dakosmu

#2
Interface.cpp


#include "stdafx.h"
#include "Interface.h"
#include "Camera.h"
#include "FullMap.h"
#include "MoveList.h"
#include "Protect.h"
#include "Window.h"

/*WideScreen*/
#include "CWideScreen.h"
/**/

Interface gInterface;

Interface::Interface()
{
    memset(this->Data, 0, sizeof(this->Data));
}

Interface::~Interface()
{

}

void Interface::Init()
{
    SetCompleteHook(0xE8, 0x0052698A, &this->RenderLogInScene);

    SetCompleteHook(0xE8, 0x005269A2, &this->RenderCharacterScene);

    SetCompleteHook(0xE8, 0x005269B6, &this->RenderMainScene);

    SetCompleteHook(0xE8, 0x00510DEA, &this->LoadImages);

    SetCompleteHook(0xE8, 0x005254B2, &this->MyUpdateWindowsMouse);

    SetCompleteHook(0xE8, 0x004BC0DE, &this->MyRenderWindows);
}

void Interface::RenderLogInScene(HDC Hdc)
{
    SetWindowText(g_hWnd, gProtect.m_MainInfo.WindowName);

    ((void(__cdecl*)(HDC Hdc)) 0x00521630)(Hdc);
}

void Interface::RenderCharacterScene(HDC Hdc)
{
    SetWindowText(g_hWnd, gProtect.m_MainInfo.WindowName);

    ((void(__cdecl*)(HDC Hdc)) 0x00523B30)(Hdc);
}

void Interface::RenderMainScene()
{
    gWindow.ChangeWindowText();

    ((void(__cdecl*)()) 0x00525A00)();
}

void Interface::LoadImages()
{
    ((void(__cdecl*)()) 0x0050EB80)(); // OpenImages

    /*WideScreen*/
    OpenTGA("Interface\\WDecorOld.tga", WDecorOldTEXTURE, GL_NEAREST, GL_CLAMP, false, true);
    /**/
}

void Interface::MyUpdateWindowsMouse()
{
    UpdateWindowsMouse();

    gFullMap.CheckZoomButton();

    gMoveList.CheckMoveListMouse();
}

void Interface::MyRenderWindows()
{
    RenderWindows();
}

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;
}

void Interface::DrawIMG(short ObjectID, float PosX, float PosY, float ScaleX, float ScaleY)
{
    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;
    }

    RenderBitmap(this->Data[ObjectID].ModelID, PosX, PosY, this->Data[ObjectID].Width, this->Data[ObjectID].Height, 0, 0, ScaleX, ScaleY, 1, 1);
}

void Interface::DrawIMG(short ObjectID, float PosX, float PosY, float u, float v, float ScaleX, float ScaleY)
{
    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;
    }

    RenderBitmap(this->Data[ObjectID].ModelID, PosX, PosY, this->Data[ObjectID].Width, this->Data[ObjectID].Height, u, v, ScaleX, ScaleY, 1, 1);
}

bool Interface::IsWorkZone(short ObjectID)
{
    if ((MouseX < this->Data[ObjectID].X || MouseX > this->Data[ObjectID].MaxX) || (MouseY < this->Data[ObjectID].Y || MouseY > this->Data[ObjectID].MaxY))
    {
        return false;
    }

    return true;
}


GuildLogo.cpp


#include "stdafx.h"
#include "GuildLogo.h"

/*WideScreen*/
#include "CWideScreen.h"
/**/

CGuildLogo gGuildLogo;

CGuildLogo::CGuildLogo()
{

}

CGuildLogo::~CGuildLogo()
{

}

void CGuildLogo::Init()
{
    SetCompleteHook(0xE8, 0x004BD28B, &this->DrawGuildLogo);
}

void CGuildLogo::DrawGuildLogo(int x, int y, DWORD c)
{
    DWORD character = *(DWORD*)(c + 564); //Get Character Struct

    if (*(BYTE*)(character + 0x84) == 1) //Check Character Type
    {
        if (*(short*)(character + 0x1DA) != -1) //Check Character Guild
        {
            CreateGuildMark(*(WORD*)(character + 0x1DA), true); //CreateGuildMark

            RenderBitmap(0x22, ((float)x - 21.0f), (float)y, 16.0f, 16.0f, 0.0f, 0.0f, 1.0f, 1.0f, true, true); //RenderBitmap
        }
    }

    /*WideScreen*/
    RenderBoolean((m_Resolution >= R1280x720 ? (int)(x * 0.75f) : x), y, c); //RenderBoolean   
    /**/
}


CWideScreen.h

#pragma once
#define RENDER_ITEMVIEW_FAR 2000.f

#define CameraMatrix ((float (*)[4])0x083A4140)
#define ScreenCenterX *(int*)0x083A429C
#define ScreenCenterY *(int*)0x083A42A0
#define PerspectiveX *(float*)0x083A42A4
#define PerspectiveY *(float*)0x083A42A8
#define CameraViewFar *(float*)0x00561550
#define MousePosition ((float*)0x083A4284)
#define glViewport2 ((void(__cdecl*)(int x, int y, int Width, int Height)) 0x00511910)
#define gluPerspective2 ((void(__cdecl*)(float Fov, float Aspect, float ZNear, float ZFar)) 0x00511220)
#define CameraFOV *(float*)0x00561554
#define CameraViewNear *(float*)0x0056154C
#define CameraAngle ((float*)0x083A42B8)
#define CameraPosition ((float*)0x083A42D4)
#define CameraTopViewEnable *(bool*)0x083A42E9
#define AlphaTestEnable *(bool*)0x083A411D
#define TextureEnable *(bool*)0x083A4125
#define DepthTestEnable *(bool*)0x083A411E
#define CullFaceEnable *(bool*)0x083A411C
#define DepthMaskEnable *(bool*)0x083A42E8
#define FogEnable *(bool*)0x083A42EA
#define FogDensity *(GLfloat*)0x00561558
#define FogColor ((GLfloat*)0x0056155C)
#define GetOpenGLMatrix ((void(__cdecl*)(float Matrix[3][4])) 0x005111D0)

#define RenderText_1 ((double(__cdecl*)(int iPos_x, int iPos_y, const char* pszText, int iBoxWidth, int iSort, SIZE* lpTextSize)) 0x0047F7A0)
#define GlobalText ((char(*)[300])0x07D29D24)

#define SubChestOpened *(DWORD*)0x7EAA14C

inline void TEXCOORD(float* c, float u, float v)
{
c[0] = u;
c[1] = v;
}

enum CTexturesCWideScreen
{
BITMAP_Interface01 = 12,
BITMAP_Interface02,
BITMAP_Interface03,
BITMAP_Interface04,
BITMAP_Menu03_new = 232,
BITMAP_Menu04,
BITMAP_Message_box = 240,
BITMAP_OK,
BITMAP_CANCEL2 = BITMAP_OK+3,
WDecorOldTEXTURE = 1290,
};

int WGetTextWidth(char* buff);

class CWideScreen
{
public:
CWideScreen();
virtual ~CWideScreen();

float WCenter;
float numW;

static void __thiscall InfoWinPos(DWORD* This, int x, int y);

void Load();
private:
};

extern CWideScreen gCWideScreen;

Creditos
Kapocha33
Bon Dia

ahgwork


vxtxr


🡱 🡳
Real Time Web Analytics